| @@ -0,0 +1,48 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| @TableName(value = "wx_c_user_basic_child") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxCUserBasicChild extends BaseTenantEntity { | |||
| protected Long id; | |||
| private Long cUserId; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") | |||
| private String name; | |||
| @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") | |||
| private Integer sex; | |||
| @io.swagger.annotations.ApiModelProperty(value="昵称",name="nickName") | |||
| private String nickName; | |||
| @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") | |||
| private Date birthdate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="备注",name="remark") | |||
| private String remark; | |||
| @TableField(exist = false) | |||
| private Date startTime; | |||
| @TableField(exist = false) | |||
| private Date endTime; | |||
| } | |||
| @@ -0,0 +1,15 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCUserBasicChild; | |||
| import com.iformall.domain.po.WxCreditHistory; | |||
| import java.util.List; | |||
| public interface WxCUserBasicChildMapper extends CommonMapper<WxCUserBasicChild, Long>{ | |||
| List<WxCreditHistory> findList(WxCUserBasicChild record); | |||
| int updDelById(WxCUserBasicChild record); | |||
| } | |||
| @@ -0,0 +1,18 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.*; | |||
| import java.util.List; | |||
| public interface WxCUserBasicChildService { | |||
| PageInfo<WxCUserBasicChild> listAsPage(WxCUserBasicChild record, Integer pageIndex, Integer pageSize); | |||
| List<WxCreditHistory> findList(WxCUserBasicChild record); | |||
| WxCUserBasicChild saveOrUpdate(WxCUserBasicChild record); | |||
| int updDelById(WxCUserBasicChild record); | |||
| } | |||
| @@ -0,0 +1,55 @@ | |||
| package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.mapper.WxCUserBasicChildMapper; | |||
| import com.iformall.service.*; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.*; | |||
| @Service | |||
| @Slf4j | |||
| public class WxCUserBasicChildServiceImpl implements WxCUserBasicChildService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxCUserBasicChildMapper wxCUserBasicChildMapper; | |||
| @Override | |||
| public PageInfo<WxCUserBasicChild> listAsPage(WxCUserBasicChild record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicChildMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public List<WxCreditHistory> findList(WxCUserBasicChild record) { | |||
| return wxCUserBasicChildMapper.findList(record); | |||
| } | |||
| @Override | |||
| public WxCUserBasicChild saveOrUpdate(WxCUserBasicChild record) { | |||
| Date curr = new Date(); | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreateDate(curr); | |||
| record.setUpdateDate(curr); | |||
| wxCUserBasicChildMapper.insert(record); | |||
| } else { | |||
| record.setUpdateDate(curr); | |||
| wxCUserBasicChildMapper.updateById(record); | |||
| } | |||
| return record; | |||
| } | |||
| @Override | |||
| public int updDelById(WxCUserBasicChild record) { | |||
| return wxCUserBasicChildMapper.updDelById(record); | |||
| } | |||
| } | |||
| @@ -0,0 +1,68 @@ | |||
| <?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.WxCUserBasicChildMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUserBasicChild"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | |||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||
| <result column="sex" jdbcType="INTEGER" property="sex" /> | |||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName" /> | |||
| <result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`c_user_id`,`name`,`nick_name`,`birthdate`,`sex`,`remark`,`create_date`,`update_date` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where del_status = 0 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| and `c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != nickName "> | |||
| and `nick_name` like concat('%', #{nickName},'%') | |||
| </if> | |||
| <if test=" null != sex "> | |||
| and `sex` = #{sex} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and create_date <= #{endTime} | |||
| </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 ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxCUserBasicChild" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_c_user_basic_child | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <update id="updDelById" parameterType="com.iformall.domain.po.WxCUserBasicChild"> | |||
| update wx_c_user_basic_child set del_status = 0 where id = #{id} and tenant_id = #{tenantId} | |||
| </update> | |||
| </mapper> | |||