Commit 61b9e60c authored by libin's avatar libin

旅游标签

parent fd87710c
...@@ -19,23 +19,28 @@ import lombok.Data; ...@@ -19,23 +19,28 @@ import lombok.Data;
public class TourGoodSite implements Serializable { public class TourGoodSite implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@ApiModelProperty("") @ApiModelProperty("")
private Integer id; private Integer id;
//路线id /**
* 路线id
*/
@Column(name = "good_id") @Column(name = "good_id")
@ApiModelProperty(value = "路线id") @ApiModelProperty(value = "路线id")
private Integer goodId; private Integer goodId;
//站点名称 /**
@Column(name = "name") * 站点名称
*/
@Column(name = "name")
@ApiModelProperty(value = "站点名称") @ApiModelProperty(value = "站点名称")
private String name; private String name;
//站点地址 /**
* 站点地址
*/
@Column(name = "address") @Column(name = "address")
@ApiModelProperty(value = "站点地址") @ApiModelProperty(value = "站点地址")
private String address; private String address;
...@@ -73,8 +78,6 @@ public class TourGoodSite implements Serializable { ...@@ -73,8 +78,6 @@ public class TourGoodSite implements Serializable {
@ApiModelProperty("地址-市(名称)") @ApiModelProperty("地址-市(名称)")
private Integer cityName; private Integer cityName;
//出发时间 //出发时间
@Column(name = "depart_time") @Column(name = "depart_time")
@ApiModelProperty(value = "出发时间") @ApiModelProperty(value = "出发时间")
......
package com.xxfc.platform.tour.entity; package com.xxfc.platform.tour.entity;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import javax.persistence.*; import javax.persistence.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
* 旅游线路核销明细 * 旅游线路核销明细
* *
* @author zjw * @author zjw
* @email nishijjo@qq.com * @email nishijjo@qq.com
* @date 2019-06-14 09:36:50 * @date 2019-06-14 09:36:50
*/ */
@Data @Data
@Table(name = "tour_good_verification") @Table(name = "tour_good_verification")
@ApiModel("旅游线路核销明细")
public class TourGoodVerification implements Serializable { public class TourGoodVerification implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 主键id * 主键id
*/ */
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键id") @ApiModelProperty("主键id")
private Integer id; private Integer id;
/** /**
* 分公司id * 日期规格
*/ */
@Column(name = "spe_id") @Column(name = "spe_id")
@ApiModelProperty(value = "日期规格id") @ApiModelProperty(value = "日期规格id")
private Integer speId; private Integer speId;
/** /**
* 旅游路线id * 旅游路线id
*/ */
@Column(name = "good_id") @Column(name = "good_id")
@ApiModelProperty(value = "旅游路线id") @ApiModelProperty(value = "旅游路线id")
private Integer goodId; private Integer goodId;
/** /**
* 旅游路线id * 出发路线id
*/ */
@Column(name = "site_id") @Column(name = "site_id")
@ApiModelProperty(value = "出发路线id") @ApiModelProperty(value = "出发路线id")
private Integer siteId; private Integer siteId;
/**
/** * 出发时间
* 总人数 */
@Column(name = "depart_time")
@ApiModelProperty("出发时间")
private Long departTime;
/**
* 总人数
*/ */
@Column(name = "total_person") @Column(name = "total_person")
@ApiModelProperty(value = "总人数") @ApiModelProperty(value = "总人数")
private Integer totalPerson; private Integer totalPerson;
/** /**
* 核销人数 * 核销人数
*/ */
@Column(name = "verification_person") @Column(name = "verification_person")
@ApiModelProperty(value = "核销人数") @ApiModelProperty(value = "核销人数")
private Integer verificationPerson; private Integer verificationPerson;
/** /**
* 状态:0-未发车;1-已发车 * 状态:0-未发车;1-已发车
*/ */
@Column(name = "status") @Column(name = "status")
@ApiModelProperty(value = "状态:0-未发车;1-已发车") @ApiModelProperty(value = "状态:0-未发车;1-已发车")
private Integer status; private Integer status;
/** /**
* 是否删除:0-正常;1-删除 * 是否删除:0-正常;1-删除
*/ */
@Column(name = "is_del") @Column(name = "is_del")
@ApiModelProperty(value = "是否删除:0-正常;1-删除") @ApiModelProperty(value = "是否删除:0-正常;1-删除")
private Integer isDel; private Integer isDel;
} }
...@@ -8,15 +8,25 @@ import org.springframework.cache.annotation.EnableCaching; ...@@ -8,15 +8,25 @@ import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import tk.mybatis.spring.annotation.MapperScan;
@SpringBootApplication /**
* @author libin
* @version 1.0
* @description 旅游
* @data 2019/6/14 11:19
*/
@SpringBootApplication(scanBasePackages = {
"com.xxfc.platform",
"com.github.wxiaoqi.*"
})
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableScheduling @EnableScheduling
@EnableAceAuthClient @EnableAceAuthClient
@EnableFeignClients({"com.github.wxiaoqi.security.auth.client.feign", "com.github.wxiaoqi.security.admin.feign","com.xxfc.platform"}) @EnableFeignClients({"com.github.wxiaoqi.security.auth.client.feign", "com.github.wxiaoqi.security.admin.feign","com.xxfc.platform"})
@EnableAceCache @EnableAceCache
@EnableCaching @EnableCaching
@tk.mybatis.spring.annotation.MapperScan(basePackages = "com.xxfc.platform.tour.mapper") @MapperScan(basePackages = "com.xxfc.platform.tour.mapper")
public class TourApplication { public class TourApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -4,6 +4,7 @@ import com.github.wxiaoqi.security.admin.feign.dto.UserDTO; ...@@ -4,6 +4,7 @@ import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.tour.dto.TourTagBannerDTO; import com.xxfc.platform.tour.dto.TourTagBannerDTO;
import com.xxfc.platform.tour.mapper.TourTagBannerMapper; import com.xxfc.platform.tour.mapper.TourTagBannerMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -108,7 +109,11 @@ public class TourTagBannerBiz extends BaseBiz<TourTagBannerMapper,TourTagBanner> ...@@ -108,7 +109,11 @@ public class TourTagBannerBiz extends BaseBiz<TourTagBannerMapper,TourTagBanner>
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateTourBannerByBatch(List<TourTagBannerDTO> tourTagBannerDTOS,UserDTO userDTO) { public void updateTourBannerByBatch(List<TourTagBannerDTO> tourTagBannerDTOS,UserDTO userDTO) {
List<Long> tourTagBannerIds = tourTagBannerDTOS.stream().filter(tourTagBannerDTO -> Objects.nonNull(tourTagBannerDTO.getId())).map(TourTagBannerDTO::getId).collect(Collectors.toList()); List<Long> tourTagBannerIds = tourTagBannerDTOS.stream().filter(tourTagBannerDTO -> Objects.nonNull(tourTagBannerDTO.getId())).map(TourTagBannerDTO::getId).collect(Collectors.toList());
mapper.updateTourBannerStatusByTagannerIdsAndTagId(tourTagBannerIds,tourTagBannerDTOS.get(0).getTagId(),1); if (CollectionUtils.isNotEmpty(tourTagBannerIds)){
mapper.updateTourBannerStatusByTagannerIdsAndTagId(tourTagBannerIds,tourTagBannerDTOS.get(0).getTagId(),1);
}else {
mapper.updateTourTagBannerStatusByTagId(tourTagBannerDTOS.get(0).getTagId(),1,Instant.now().toEpochMilli());
}
tourTagBannerDTOS.stream().filter(tourTagBannerDTO -> Objects.isNull(tourTagBannerDTO.getId())).peek(tourTagBannerDTO -> { tourTagBannerDTOS.stream().filter(tourTagBannerDTO -> Objects.isNull(tourTagBannerDTO.getId())).peek(tourTagBannerDTO -> {
save(tourTagBannerDTO,userDTO); save(tourTagBannerDTO,userDTO);
}).count(); }).count();
......
...@@ -198,8 +198,8 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> { ...@@ -198,8 +198,8 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> {
* @param name * @param name
* @return * @return
*/ */
public boolean checkTagNameExist(String name) { public boolean checkTagNameExist(String name,Integer id) {
List<TourTag> tourTags = mapper.findByTagName(name); List<TourTag> tourTags = mapper.findByTagName(name,id);
return CollectionUtils.isNotEmpty(tourTags); return CollectionUtils.isNotEmpty(tourTags);
} }
......
...@@ -17,9 +17,20 @@ import java.util.List; ...@@ -17,9 +17,20 @@ import java.util.List;
*/ */
@Repository @Repository
public interface TourTagMapper extends Mapper<TourTag> { public interface TourTagMapper extends Mapper<TourTag> {
/**
* 根据热度查询标签
* @param tag
* @return
*/
@Select("select * from tour_tag where is_del=#{isDel} and is_hot=#{isHot} order by rank ASC") @Select("select * from tour_tag where is_del=#{isDel} and is_hot=#{isHot} order by rank ASC")
List<TourTag> findHotListTag(TourTag tag); List<TourTag> findHotListTag(TourTag tag);
/**
* 根据删除状态查询标签
* @param tagBanner
* @return
*/
@Select("select * from tour_tag where is_del=#{isDel} order by rank ASC") @Select("select * from tour_tag where is_del=#{isDel} order by rank ASC")
@ResultMap(value = "tourTagMap") @ResultMap(value = "tourTagMap")
List<TourTag> findAllByIsDel(TourTag tagBanner); List<TourTag> findAllByIsDel(TourTag tagBanner);
...@@ -49,16 +60,37 @@ public interface TourTagMapper extends Mapper<TourTag> { ...@@ -49,16 +60,37 @@ public interface TourTagMapper extends Mapper<TourTag> {
@Update("update tour_tag set `is_del`=#{status} where `id`=#{id}") @Update("update tour_tag set `is_del`=#{status} where `id`=#{id}")
int updateTourTagStatusById(@Param("id") Integer id, @Param("status") int status); int updateTourTagStatusById(@Param("id") Integer id, @Param("status") int status);
/**
* 编辑标签
* @param tourTagDTO
* @return
*/
@Update("update tour_tag set `name`=#{name},`img`=#{img},`describe`=#{describe},`link`=#{link}" + @Update("update tour_tag set `name`=#{name},`img`=#{img},`describe`=#{describe},`link`=#{link}" +
",`rank`=#{rank},`upd_time`=#{updTime} where `id`=#{id}") ",`rank`=#{rank},`upd_time`=#{updTime} where `id`=#{id}")
int updateTourTag(TourTagDTO tourTagDTO); int updateTourTag(TourTagDTO tourTagDTO);
/**
* 更新标签热度
* @param id
* @param state
* @return
*/
@Update("update tour_tag set `is_hot`=#{state} where `id`=#{id}") @Update("update tour_tag set `is_hot`=#{state} where `id`=#{id}")
int updateTourTagHotSate(@Param("id") Integer id, @Param("state") Integer state); int updateTourTagHotSate(@Param("id") Integer id, @Param("state") Integer state);
@Select("select * from tour_tag where name=#{name}") /**
List<TourTag> findByTagName(String name); * 检测标签名是否存在
* @param name
* @param id
* @return
*/
List<TourTag> findByTagName(@Param("name") String name,@Param("id") Integer id);
/**
*根据状态查询 标签
* @param status
* @return
*/
@Select("select `id`,`name` from tour_tag where `is_del`=#{status}") @Select("select `id`,`name` from tour_tag where `is_del`=#{status}")
List<TourTag> selectByStuatus(Integer status); List<TourTag> selectByStuatus(Integer status);
} }
...@@ -125,8 +125,8 @@ public class TourTagAdminController extends TourBaseController<TourTagBiz> { ...@@ -125,8 +125,8 @@ public class TourTagAdminController extends TourBaseController<TourTagBiz> {
*/ */
@GetMapping("/exist") @GetMapping("/exist")
@ApiOperation("校验标签名是否存在") @ApiOperation("校验标签名是否存在")
public ObjectRestResponse checkTagNameExists(@RequestParam("name") String name){ public ObjectRestResponse checkTagNameExists(@RequestParam("name") String name,@RequestParam(value = "id",required = false) Integer id){
boolean exist = getBaseBiz().checkTagNameExist(name); boolean exist = getBaseBiz().checkTagNameExist(name,id);
return ObjectRestResponse.succ(exist); return ObjectRestResponse.succ(exist);
} }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="package com.xxfc.platform.tour.mapper.TourGoodVerificationMapper"> <mapper namespace="com.xxfc.platform.tour.mapper.TourGoodVerificationMapper">
<!-- 可根据自己的需求,是否要使用 --> <!-- 可根据自己的需求,是否要使用 -->
<resultMap type="package com.xxfc.platform.tour.entity.TourGoodVerification" id="tourGoodVerificationMap"> <resultMap type="com.xxfc.platform.tour.entity.TourGoodVerification" id="tourGoodVerificationMap">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="companyId" column="company_id"/> <result property="speId" column="spe_id"/>
<result property="siteId" column="site_id"/>
<result property="goodId" column="good_id"/> <result property="goodId" column="good_id"/>
<result property="departTime" column="depart_time"/> <result property="departTime" column="depart_time"/>
<result property="totalPerson" column="total_person"/> <result property="totalPerson" column="total_person"/>
......
...@@ -23,4 +23,9 @@ ...@@ -23,4 +23,9 @@
values(#{name},#{img},#{describe},#{rank},#{ctrTime}) values(#{name},#{img},#{describe},#{rank},#{ctrTime})
</insert> </insert>
<select id="findByTagName" resultMap="tourTagMap">
select * from tour_tag where name=#{name} <if test="id!=null">
AND `id` not in (#{id})
</if>;
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment