|
@@ -0,0 +1,287 @@ |
|
|
|
|
|
<?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"> |
|
|
|
|
|
|
|
|
|
|
|
<!-- |
|
|
|
|
|
${table_name}(${table_comment}) |
|
|
|
|
|
注意:分隔线以下 不增加业务,有新增自定义业务时加到分隔线上面 |
|
|
|
|
|
--> |
|
|
|
|
|
<mapper namespace="com.qmrz.domain.mapper.${table_name2}Mapper"> |
|
|
|
|
|
|
|
|
|
|
|
<select id="getList" resultType="java.util.LinkedHashMap"> |
|
|
|
|
|
select <#list columnList as item>t.${item.column_name}<#if item_has_next>,</#if></#list> |
|
|
|
|
|
,zp2.name gldwname,zp3.name gldw2name,za.name xzqhname |
|
|
|
|
|
,IFNULL(th.status,0) status |
|
|
|
|
|
|
|
|
|
|
|
<!-- 已分派 --> |
|
|
|
|
|
<if test='where_status=="1"'> |
|
|
|
|
|
,th.fppoliceid,fpP1.fullname fppolicename |
|
|
|
|
|
,th.jspoliceid,jsP1.fullname jspolicename |
|
|
|
|
|
,th.fptime |
|
|
|
|
|
,if(th.chpoliceid,1,0) chstatus, if(th.thpoliceid,1,0) thstatus |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 2撤回 3退回 --> |
|
|
|
|
|
<if test='where_status.contains("2") || where_status.contains("3")'> |
|
|
|
|
|
,th.currpoliceid chthpoliceid,p.fullname chthpolicename |
|
|
|
|
|
,th.operationtime chthtime |
|
|
|
|
|
,if(th.chpoliceid,1,0) chstatus, if(th.thpoliceid,1,0) thstatus |
|
|
|
|
|
,th.remarks |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 已反馈 --> |
|
|
|
|
|
<if test='where_status=="4"'> |
|
|
|
|
|
,th.currpoliceid fkpoliceid,p.fullname fkpolicename |
|
|
|
|
|
,th.operationtime fktime |
|
|
|
|
|
,if(th.chpoliceid,1,0) chstatus, if(th.thpoliceid,1,0) thstatus |
|
|
|
|
|
,th.memo,th.remarks, th.gldw fkgldw, fkzp2.name fkgldwname |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 无需处理 --> |
|
|
|
|
|
<if test='where_status=="5"'> |
|
|
|
|
|
,th.currpoliceid wxclpoliceid,p.fullname wxclpolicename |
|
|
|
|
|
,th.operationtime wxcltime |
|
|
|
|
|
,if(th.chpoliceid,1,0) chstatus, if(th.thpoliceid,1,0) thstatus |
|
|
|
|
|
,th.remarks |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
from ${table_name} t |
|
|
|
|
|
left join zonepubinfo zp2 on zp2.pubcode = t.gldw <!-- 第4级 管辖单位(派出所代码) --> |
|
|
|
|
|
left join zonepubinfo zp3 on zp3.pubcode = t.gldw2 <!-- 第5级 管辖单位(警务区代码) --> |
|
|
|
|
|
left join zoneadmin za on za.id = t.xzqh <!-- 行政区划 --> |
|
|
|
|
|
left join ${table_name}relation th on t.${primaryKeyName}=th.lnid |
|
|
|
|
|
left join police p on p.id=th.currpoliceid <!-- 最近一次操作时的人员ID(分派时为接收人) --> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 已分派 --> |
|
|
|
|
|
<if test='where_status=="1"'> |
|
|
|
|
|
left join police fpP1 on fpP1.id=th.fppoliceid |
|
|
|
|
|
left join police jsP1 on jsP1.id=th.jspoliceid |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 已反馈 --> |
|
|
|
|
|
<if test='where_status=="4"'> |
|
|
|
|
|
left join zonepubinfo fkzp2 on fkzp2.pubcode = th.gldw and th.memo=4 |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
<where> |
|
|
|
|
|
<include refid="common_where" /> |
|
|
|
|
|
|
|
|
|
|
|
<!--类型区别 最新: 0 未分派 1已分派 2 撤回 3 退回 4 已反馈 5无需处理--> |
|
|
|
|
|
<choose> |
|
|
|
|
|
<when test='where_status=="0"'> |
|
|
|
|
|
<!-- and th.status is null --> |
|
|
|
|
|
and ifnull(th.status,0) = 0 |
|
|
|
|
|
</when> |
|
|
|
|
|
<otherwise> |
|
|
|
|
|
and th.status in ( ${'$'}{where_status} ) |
|
|
|
|
|
</otherwise> |
|
|
|
|
|
</choose> |
|
|
|
|
|
|
|
|
|
|
|
<!--app模糊搜索 --> |
|
|
|
|
|
<if test="_parameter.containsKey('like_appkeyword')"> |
|
|
|
|
|
<!-- TODO 需处理 |
|
|
|
|
|
and CONCAT(t.ownername,'|',t.ownerphone,'|',t.houseaddr) like concat('%', ${'#'}{like_appkeyword} ,'%') |
|
|
|
|
|
--> |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
<!--查询当日 或 历史--> |
|
|
|
|
|
<if test="_parameter.containsKey('where_historytype')"> |
|
|
|
|
|
<!--当日--> |
|
|
|
|
|
<if test=" where_historytype == 1 "> |
|
|
|
|
|
and DATEDIFF(th.operationtime,now())=0 |
|
|
|
|
|
</if> |
|
|
|
|
|
<!--历史--> |
|
|
|
|
|
<if test=" where_historytype == 2 "> |
|
|
|
|
|
<![CDATA[ and DATEDIFF(th.operationtime,now())<0 ]]> |
|
|
|
|
|
</if> |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
<!--反馈时间查询--> |
|
|
|
|
|
<if test="_parameter.containsKey('where_fkbegintime')"> |
|
|
|
|
|
<![CDATA[ and th.operationtime >= ${'#'}{where_fkbegintime} ]]> |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="_parameter.containsKey('where_fkendtime')"> |
|
|
|
|
|
<![CDATA[ and th.operationtime < ${'#'}{where_fkendtime} ]]> |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
<!--接受人 status=1 已分派 | 撤回人退回人 status in (2,3)撤回退回 | 反馈人 status=4 已反馈 5无需处理--> |
|
|
|
|
|
<if test='where_status=="1"'> |
|
|
|
|
|
<if test="_parameter.containsKey('like_fppolicename')"> |
|
|
|
|
|
and fpP1.fullname like concat('%',${'#'}{like_fppolicename},'%') |
|
|
|
|
|
</if> |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
<choose> |
|
|
|
|
|
<!-- 接收人 --> |
|
|
|
|
|
<when test="_parameter.containsKey('like_jspolicename')"> |
|
|
|
|
|
and p.fullname like concat('%',${'#'}{like_jspolicename},'%') |
|
|
|
|
|
</when> |
|
|
|
|
|
<!-- 撤回人 --> |
|
|
|
|
|
<when test="_parameter.containsKey('like_chpolicename')"> |
|
|
|
|
|
and p.fullname like concat('%',${'#'}{like_chpolicename},'%') |
|
|
|
|
|
</when> |
|
|
|
|
|
<!-- 退回人 --> |
|
|
|
|
|
<when test="_parameter.containsKey('like_thpolicename')"> |
|
|
|
|
|
and p.fullname like concat('%',${'#'}{like_thpolicename},'%') |
|
|
|
|
|
</when> |
|
|
|
|
|
<!-- 撤回/退回人 --> |
|
|
|
|
|
<when test="_parameter.containsKey('like_chthpolicename')"> |
|
|
|
|
|
and p.fullname like concat('%',${'#'}{like_chthpolicename},'%') |
|
|
|
|
|
</when> |
|
|
|
|
|
<!-- 反馈人 --> |
|
|
|
|
|
<when test="_parameter.containsKey('like_fkpolicename')"> |
|
|
|
|
|
and p.fullname like concat('%',${'#'}{like_fkpolicename},'%') |
|
|
|
|
|
</when> |
|
|
|
|
|
<!-- 无需处理人 --> |
|
|
|
|
|
<when test="_parameter.containsKey('like_wxclpolicename')"> |
|
|
|
|
|
and p.fullname like concat('%',${'#'}{like_wxclpolicename},'%') |
|
|
|
|
|
</when> |
|
|
|
|
|
</choose> |
|
|
|
|
|
|
|
|
|
|
|
<if test="_parameter.containsKey('where_fppoliceid')"> |
|
|
|
|
|
and th.fppoliceid = ${'#'}{where_fppoliceid} |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
<choose> |
|
|
|
|
|
<when test="_parameter.containsKey('where_jspoliceid')"> |
|
|
|
|
|
and th.currpoliceid = ${'#'}{where_jspoliceid} |
|
|
|
|
|
</when> |
|
|
|
|
|
|
|
|
|
|
|
<when test="_parameter.containsKey('where_chpoliceid')"> |
|
|
|
|
|
and th.currpoliceid = ${'#'}{where_chpoliceid} |
|
|
|
|
|
</when> |
|
|
|
|
|
<when test="_parameter.containsKey('where_thpoliceid')"> |
|
|
|
|
|
and th.currpoliceid = ${'#'}{where_thpoliceid} |
|
|
|
|
|
</when> |
|
|
|
|
|
<when test="_parameter.containsKey('where_chthpoliceid')"> |
|
|
|
|
|
and th.currpoliceid = ${'#'}{where_chthpoliceid} |
|
|
|
|
|
</when> |
|
|
|
|
|
|
|
|
|
|
|
<when test="_parameter.containsKey('where_fkpoliceid')"> |
|
|
|
|
|
and th.currpoliceid = ${'#'}{where_fkpoliceid} |
|
|
|
|
|
</when> |
|
|
|
|
|
<when test="_parameter.containsKey('where_wxclpoliceid')"> |
|
|
|
|
|
and th.currpoliceid = ${'#'}{where_wxclpoliceid} |
|
|
|
|
|
</when> |
|
|
|
|
|
</choose> |
|
|
|
|
|
|
|
|
|
|
|
<!--反馈结果--> |
|
|
|
|
|
<if test="_parameter.containsKey('where_memo')"> |
|
|
|
|
|
and th.memo = ${'#'}{where_memo} |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
<!--过滤出选中--> |
|
|
|
|
|
<if test="_parameter.containsKey('where_idlist')"> |
|
|
|
|
|
and t.${primaryKeyName} in ( |
|
|
|
|
|
<foreach item="item" index="index" collection="where_idlist" separator="," > |
|
|
|
|
|
${'#'}{item} |
|
|
|
|
|
</foreach> |
|
|
|
|
|
) |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 系统数据权限条件 登入信息过滤 不能加前缀 where_ --> |
|
|
|
|
|
<if test="_parameter.containsKey('policeid')"> |
|
|
|
|
|
and th.currpoliceid= ${'#'}{policeid} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="_parameter.containsKey('gldw2List')"> |
|
|
|
|
|
and t.gldw2 in ( |
|
|
|
|
|
<foreach item="item" index="index" collection="gldw2List" separator=","> |
|
|
|
|
|
${'#'}{item} |
|
|
|
|
|
</foreach> |
|
|
|
|
|
) |
|
|
|
|
|
</if> |
|
|
|
|
|
</where> |
|
|
|
|
|
|
|
|
|
|
|
<if test='where_status == "0"'> |
|
|
|
|
|
${orderBy} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test='where_status != "0"'> |
|
|
|
|
|
order by th.operationtime desc , t.${primaryKeyName} desc |
|
|
|
|
|
</if> |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<!-- ========================= 分隔线以下为生成的通用代码 ========================= --> |
|
|
|
|
|
<!-- |
|
|
|
|
|
注意: |
|
|
|
|
|
1、增加条件必须增加 _parameter.containsKey |
|
|
|
|
|
2、修改字段手动更改此文件,不推荐重新生成后全部覆盖 |
|
|
|
|
|
--> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 通用查询条件 --> |
|
|
|
|
|
<sql id="common_where"> |
|
|
|
|
|
<#list columnList as item> |
|
|
|
|
|
<if test="_parameter.containsKey('where_${item.column_name}')">and t.${item.column_name} = ${"#"}{where_${item.column_name}}</if> |
|
|
|
|
|
</#list> |
|
|
|
|
|
|
|
|
|
|
|
<#list columnList as item> |
|
|
|
|
|
<if test="_parameter.containsKey('like_${item.column_name}')">and t.${item.column_name} like concat('%',${"#"}{like_${item.column_name}},'%')</if> |
|
|
|
|
|
</#list> |
|
|
|
|
|
|
|
|
|
|
|
<if test="_parameter.containsKey('list_${primaryKeyName}')"> |
|
|
|
|
|
and t.${primaryKeyName} in |
|
|
|
|
|
<foreach collection="list_${primaryKeyName}" item="item" open="(" separator="," close=")"> |
|
|
|
|
|
${"#"}{item} |
|
|
|
|
|
</foreach> |
|
|
|
|
|
</if> |
|
|
|
|
|
</sql> |
|
|
|
|
|
<!-- 通用查询记录 --> |
|
|
|
|
|
<select id="selectList" resultType="java.util.LinkedHashMap"> |
|
|
|
|
|
select <#list columnList as item>t.${item.column_name}<#if item_has_next>,</#if></#list> |
|
|
|
|
|
from ${table_name} t |
|
|
|
|
|
<where> |
|
|
|
|
|
<include refid="common_where" /> |
|
|
|
|
|
</where> |
|
|
|
|
|
${orderBy} |
|
|
|
|
|
<if test="_parameter.containsKey('__limit__')"> |
|
|
|
|
|
<#noparse>limit #{__limit__}</#noparse> |
|
|
|
|
|
</if> |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 通用查询记录总数 --> |
|
|
|
|
|
<select id="selectCount" resultType="Integer"> |
|
|
|
|
|
select count(0) as cou from ${table_name} t |
|
|
|
|
|
<where> |
|
|
|
|
|
<include refid="common_where" /> |
|
|
|
|
|
</where> |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 通用插入数据 --> |
|
|
|
|
|
<insert id="insert"> |
|
|
|
|
|
insert into ${table_name}( |
|
|
|
|
|
<trim suffixOverrides=","> |
|
|
|
|
|
<#list columnList as item> |
|
|
|
|
|
<if test="_parameter.containsKey('${item.column_name}')">${item.column_name},</if> |
|
|
|
|
|
</#list> |
|
|
|
|
|
</trim>) |
|
|
|
|
|
values( |
|
|
|
|
|
<trim suffixOverrides=","> |
|
|
|
|
|
<#list columnList as item> |
|
|
|
|
|
<if test="_parameter.containsKey('${item.column_name}')">${"#"}{${item.column_name}},</if> |
|
|
|
|
|
</#list> |
|
|
|
|
|
</trim> |
|
|
|
|
|
) |
|
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 通用更新数据 --> |
|
|
|
|
|
<update id="update"> |
|
|
|
|
|
update ${table_name} t |
|
|
|
|
|
<set> |
|
|
|
|
|
<#list columnList as item> |
|
|
|
|
|
<#if item.column_key?? && item.column_key!="PRI" || item.column_name?? && item.column_name != "id"> |
|
|
|
|
|
<if test="_parameter.containsKey('${item.column_name}')">t.${item.column_name} = ${"#"}{${item.column_name}},</if> |
|
|
|
|
|
</#if> |
|
|
|
|
|
</#list> |
|
|
|
|
|
</set> |
|
|
|
|
|
<where> |
|
|
|
|
|
<include refid="common_where" /> |
|
|
|
|
|
</where> |
|
|
|
|
|
</update> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 通用删除记录 --> |
|
|
|
|
|
<delete id="delete"> |
|
|
|
|
|
delete t from ${table_name} t |
|
|
|
|
|
<where> |
|
|
|
|
|
<include refid="common_where" /> |
|
|
|
|
|
</where> |
|
|
|
|
|
</delete> |
|
|
|
|
|
</mapper> |