| @@ -1,7 +1,5 @@ | |||
| ALTER TABLE `person_mould` | |||
| ADD COLUMN customized int(1) NOT NULL DEFAULT 0 COMMENT '是否私人定制EnumYesOrNo' AFTER `is_del`; | |||
| ALTER TABLE `person_mould` | |||
| ADD COLUMN customized_user_id BIGINT(11) COMMENT '私人定制所属用户' AFTER `customized`; | |||
| ##更新这几个表 | |||
| apimenu,apiguide,apidetail,thirdpartyapi | |||
| @@ -21,6 +21,10 @@ import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -77,7 +81,7 @@ public class PersonMouldController extends BaseController { | |||
| record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
| record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
| record.setCustomizedQuery(EnumYesOrNo.YES.getCode()); | |||
| record.setCustomizedUserId(getMemberId()); | |||
| record.setCuserId(getMemberId()); | |||
| final PageInfo<PersonMould> page = personMouldService.cListAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -132,10 +132,11 @@ public class PersonMould extends TenantEntity { | |||
| private Integer customizedQuery = 0; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否私人定制EnumYesOrNo",name="customized") | |||
| private Integer customized; | |||
| @io.swagger.annotations.ApiModelProperty(value="私人定制所属用户",name="customizedUserId") | |||
| private Long customizedUserId; | |||
| @TableField(exist = false) | |||
| private List<Long> customPersonMouldIds; | |||
| @TableField(exist = false) | |||
| private Long cuserId; | |||
| public String getSalePriceStr() { | |||
| if(salePrice!=null) { | |||
| @@ -0,0 +1,32 @@ | |||
| package com.iformall.domain.po.sm; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @TableName(value = "user_person_mould") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class UserPersonMould extends BaseEntity { | |||
| private static final long serialVersionUID = 5153174991543978589L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="PersonMould编号",name="personMouldId") | |||
| private Long personMouldId; | |||
| @io.swagger.annotations.ApiModelProperty(value="WxCuserBasicInfo编码",name="cUserId") | |||
| private Long cUserId; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @TableField(exist = false) | |||
| private List<Long> cuserIds; | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.sm.UserPersonMould; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| public interface UserPersonMouldMapper extends CommonMapper<UserPersonMould, Long> { | |||
| List<Long> findMouldIdList(UserPersonMould record); | |||
| void deleteByCuserId(@Param("cUserId") Long cUserId); | |||
| void saveBatch(@Param("list") List<UserPersonMould> list); | |||
| } | |||
| @@ -8,12 +8,14 @@ import com.iformall.domain.po.sm.MouldPatch; | |||
| import com.iformall.domain.po.sm.MouldPatchSign; | |||
| import com.iformall.domain.po.sm.PersonMould; | |||
| import com.iformall.domain.po.sm.ServicePersonMould; | |||
| import com.iformall.domain.po.sm.UserPersonMould; | |||
| import com.iformall.enums.EnumColour; | |||
| import com.iformall.enums.EnumMouldSendType; | |||
| import com.iformall.enums.EnumaMouldPatchStatus; | |||
| import com.iformall.mapper.MouldPatchMapper; | |||
| import com.iformall.mapper.PersonMouldMapper; | |||
| import com.iformall.mapper.ServicePersonMouldMapper; | |||
| import com.iformall.mapper.UserPersonMouldMapper; | |||
| import com.iformall.service.sm.MouldPatchService; | |||
| import com.iformall.service.sm.MouldPatchSignService; | |||
| import com.iformall.service.sm.PersonMouldService; | |||
| @@ -40,6 +42,9 @@ public class PersonMouldServiceImpl implements PersonMouldService { | |||
| @Autowired | |||
| ServicePersonMouldMapper servicePersonMouldMapper; | |||
| @Autowired | |||
| UserPersonMouldMapper userPersonMouldMapper; | |||
| @Override | |||
| @@ -49,6 +54,16 @@ public class PersonMouldServiceImpl implements PersonMouldService { | |||
| @Override | |||
| public PageInfo<PersonMould> cListAsPage(PersonMould record, Integer pageIndex, Integer pageSize) { | |||
| if (null != record.getCuserId()) { | |||
| UserPersonMould upm = new UserPersonMould(); | |||
| upm.setCUserId(record.getCuserId()); | |||
| List<Long> mouldIds = userPersonMouldMapper.findMouldIdList(upm); | |||
| if (null == mouldIds || mouldIds.size() <= 0 ) { | |||
| record.setId(-1L); | |||
| }else { | |||
| record.setCustomPersonMouldIds(mouldIds); | |||
| } | |||
| } | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> personMouldMapper.findCList(record)); | |||
| } | |||
| @@ -30,14 +30,13 @@ | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="customized" jdbcType="INTEGER" property="customized"/> | |||
| <result column="customized_user_id" jdbcType="INTEGER" property="customizedUserId"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`, `tenant_id`, `parent_tenant_id`, `video_type`, `cover_img`, `cover_picture`, `detail_picture`, | |||
| `title`, `sub_title`, `sex`, `age`, `colour`, `scene_sign`, `sale_price`, `price`, | |||
| `send_type`, `detail`, `remark`, `mould_sm_id`,`material`,`background_id`,`background_material`, | |||
| `status`, `puton_date`, `create_date`, `update_date`,`is_del`,`customized`,`customized_user_id` | |||
| `status`, `puton_date`, `create_date`, `update_date`,`is_del`,`customized` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -106,7 +105,12 @@ | |||
| </if> | |||
| <if test=" 1 == customizedQuery"> | |||
| and ( customized = 0 or (customized = 1 and customized_user_id = #{customizedUserId}) ) | |||
| and ( customized = 0 or (customized = 1 | |||
| and id in | |||
| <foreach collection="customPersonMouldIds" index="index" item="cIdItem" open="(" separator="," close=")"> | |||
| #{cIdItem} | |||
| </foreach> | |||
| )) | |||
| </if> | |||
| <if test=" 0 == customizedQuery"> | |||
| and customized = 0 | |||
| @@ -138,7 +142,7 @@ | |||
| `id`, `video_type`, `cover_img`, `cover_picture`, | |||
| `title`, `sub_title`, `sex`, `age`, `colour`, `scene_sign`, `sale_price`, `price`, | |||
| `send_type`, `mould_sm_id`,`material`,`background_id`,`background_material`, | |||
| `status`, `create_date`, `update_date`,`customized`,`customized_user_id` | |||
| `status`, `create_date`, `update_date`,`customized` | |||
| from person_mould | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| @@ -0,0 +1,56 @@ | |||
| <?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"> | |||
| <mapper namespace="com.iformall.mapper.UserPersonMouldMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.sm.UserPersonMould"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="person_mould_id" jdbcType="BIGINT" property="personMouldId"/> | |||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`, `person_mould_id`, `c_user_id`, `create_date`, `update_date` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by customized desc,${sortColumns}</if> | |||
| </sql> | |||
| <select id="findMouldIdList" parameterType="com.iformall.domain.po.sm.UserPersonMould" resultType="Long"> | |||
| select person_mould_id | |||
| from user_person_mould where c_user_id = #{cUserId} | |||
| </select> | |||
| <delete id = "deleteByCuserId"> | |||
| delete from user_person_mould where c_user_id = #{cUserId} | |||
| </delete> | |||
| <insert id="saveBatch" parameterType="java.util.List"> | |||
| INSERT INTO user_person_mould (`id`, `person_mould_id`, `c_user_id`,`create_date`, `update_date`) | |||
| VALUES | |||
| <foreach collection="list" item="item" separator=","> | |||
| ( | |||
| #{item.id}, | |||
| #{item.personMouldId}, | |||
| #{item.cUserId}, | |||
| #{item.createDate}, | |||
| #{item.updateDate} | |||
| ) | |||
| </foreach> | |||
| </insert> | |||
| </mapper> | |||