File was renamed from dyh-service/dyh-cust/src/main/java/cn/huge/module/region/dao/mapper/xml/SyRegionGridMapper.xml |
| | |
| | | <?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"> |
| | | <!-- |
| | | * @title: 网格化平台地域字典映射表 |
| | | * @title: 地域字典表 |
| | | * @description: 自定义sql,请自行实现业务逻辑 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time:2024-09-25 18:03:50 |
| | | * @time:2024-10-18 15:14:06 |
| | | * @version 1.0.0 |
| | | --> |
| | | <mapper namespace="cn.huge.module.region.dao.mapper.SyRegionGridMapper"> |
| | | <mapper namespace="cn.huge.module.ctuser.dao.mapper.ByRegionMapper"> |
| | | <!-- 结果集 --> |
| | | <resultMap id="dataResult" type="cn.huge.module.region.domain.po.SyRegionGrid"> |
| | | <resultMap id="dataResult" type="cn.huge.module.ctuser.domain.po.ByRegion"> |
| | | <result property="id" column="id"/> |
| | | <result property="thirdSysId" column="third_sys_id"/> |
| | | <result property="thirdSysName" column="third_sys_name"/> |
| | | <result property="thirdCode" column="third_code"/> |
| | | <result property="thirdName" column="third_name"/> |
| | | <result property="thirdParentId" column="third_parent_id"/> |
| | | <result property="regionId" column="region_id"/> |
| | | <result property="level" column="level"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | </resultMap> |
| | | <!-- 表 --> |
| | | <sql id='table-name'>dyh_sy_region_grid</sql> |
| | | <sql id='table-name'>dyh_sy_region_by</sql> |
| | | <!-- 字段 --> |
| | | <sql id="column-part"> |
| | | id, |
| | | third_sys_id, |
| | | third_sys_name, |
| | | third_code, |
| | | third_name, |
| | | third_parent_id, |
| | | region_id, |
| | | level, |
| | | create_time, |
| | | update_time |
| | | level |
| | | </sql> |
| | | <!-- 更新实体字段 --> |
| | | <sql id="set-part"> |
| | | <if test="entity.thirdSysId != null">third_sys_id = #{entity.thirdSysId},</if> |
| | | <if test="entity.thirdSysName != null">third_sys_name = #{entity.thirdSysName},</if> |
| | | <if test="entity.thirdCode != null">third_code = #{entity.thirdCode},</if> |
| | | <if test="entity.thirdName != null">third_name = #{entity.thirdName},</if> |
| | | <if test="entity.thirdParentId != null">third_parent_id = #{entity.thirdParentId},</if> |
| | | <if test="entity.regionId != null">region_id = #{entity.regionId},</if> |
| | | <if test="entity.level != null">level = #{entity.level},</if> |
| | | <if test="entity.createTime != null">create_time = #{entity.createTime},</if> |
| | | <if test="entity.updateTime != null">update_time = #{entity.updateTime}</if> |
| | | <if test="entity.level != null">level = #{entity.level}</if> |
| | | </sql> |
| | | <!-- 条件 --> |
| | | <sql id="where-part"> |
| | |
| | | <where> |
| | | <if test="terms.id != null and terms.id !=''"> |
| | | and id = #{terms.id} |
| | | </if> |
| | | <if test="terms.thirdSysId != null and terms.thirdSysId !=''"> |
| | | and third_sys_id = #{terms.thirdSysId} |
| | | </if> |
| | | <if test="terms.thirdSysName != null and terms.thirdSysName !=''"> |
| | | and third_sys_name = #{terms.thirdSysName} |
| | | </if> |
| | | <if test="terms.thirdCode != null and terms.thirdCode !=''"> |
| | | and third_code = #{terms.thirdCode} |
| | |
| | | <if test="terms.level != null and terms.level !=''"> |
| | | and level = #{terms.level} |
| | | </if> |
| | | <if test="terms.createTime != null and terms.createTime !=''"> |
| | | and DATE_FORMAT(create_time,'%Y-%m-%d') = #{terms.createTime} |
| | | </if> |
| | | <if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''"> |
| | | and (DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.createStart} |
| | | and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.createEnd}) |
| | | </if> |
| | | <if test="terms.updateTime != null and terms.updateTime !=''"> |
| | | and DATE_FORMAT(update_time,'%Y-%m-%d') = #{terms.updateTime} |
| | | </if> |
| | | <if test="terms.updateStart != null and terms.updateStart !='' and terms.updateEnd != null and terms.updateEnd !=''"> |
| | | and (DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.updateStart} |
| | | and DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.updateEnd}) |
| | | </if> |
| | | </where> |
| | | </if> |
| | | </sql> |
| | | <!-- 更新对象 --> |
| | | <update id="updateSyRegionGrid"> |
| | | <update id="updateByRegion"> |
| | | update |
| | | <include refid="table-name"/> |
| | | <set> |
| | |
| | | </where> |
| | | </update> |
| | | <!-- 条件更新对象 --> |
| | | <update id="updateSyRegionGridTerms"> |
| | | <update id="updateByRegionTerms"> |
| | | update |
| | | <include refid="table-name"/> |
| | | <set> |
| | |
| | | <include refid="where-part"/> |
| | | </update> |
| | | <!-- 根据编号物理删除 --> |
| | | <delete id="deleteSyRegionGrid"> |
| | | <delete id="deleteByRegion"> |
| | | delete from |
| | | <include refid="table-name" /> |
| | | where id = #{id} |