160 lines
9.0 KiB
XML
160 lines
9.0 KiB
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">
|
|
<mapper namespace="com.yanzhu.manage.mapper.ProMobileAttendanceConfigMapper">
|
|
|
|
<resultMap type="ProMobileAttendanceConfig" id="ProMobileAttendanceConfigResult">
|
|
<result property="id" column="id" />
|
|
<result property="comId" column="com_id" />
|
|
<result property="projectId" column="project_id" />
|
|
<result property="title" column="title" />
|
|
<result property="startDate" column="start_date" />
|
|
<result property="endDate" column="end_date" />
|
|
<result property="address" column="address" />
|
|
<result property="longitude" column="longitude" />
|
|
<result property="latitude" column="latitude" />
|
|
<result property="valid" column="valid" />
|
|
<result property="range" column="range" />
|
|
<result property="isAll" column="is_all" />
|
|
<result property="state" column="state" />
|
|
<result property="isDel" column="is_del" />
|
|
<result property="remark" column="remark" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<collection property="groupList" ofType="ProMobileAttendanceConfigGroup">
|
|
<result property="id" column="group_id"/>
|
|
<result property="cfgId" column="cfg_id"/>
|
|
<result property="groupId" column="group_id"/>
|
|
<result property="groupName" column="group_name"/>
|
|
<result property="deptName" column="dept_name"/>
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<sql id="selectProMobileAttendanceConfigVo">
|
|
select c.id, c.com_id, c.project_id, c.title, c.start_date, c.end_date, c.address, c.longitude, c.latitude, c.valid, c.range, c.is_all, c.state, c.is_del, c.remark, c.create_by, c.create_time, c.update_by, c.update_time, g.cfg_id, pg.id as group_id, pg.group_name, pg.sub_dept_name as dept_name
|
|
from pro_mobile_attendance_config c
|
|
left join pro_mobile_attendance_config_group g on c.id=g.cfg_id
|
|
left join pro_project_info_subdepts_group pg on g.group_id=pg.id
|
|
</sql>
|
|
|
|
<select id="selectProMobileAttendanceConfigList" parameterType="ProMobileAttendanceConfig" resultMap="ProMobileAttendanceConfigResult">
|
|
<include refid="selectProMobileAttendanceConfigVo"/>
|
|
<where>
|
|
c.is_del = 0
|
|
<if test="comId != null "> and c.com_id = #{comId}</if>
|
|
<if test="projectId != null "> and c.project_id = #{projectId}</if>
|
|
<if test="title != null and title != ''"> and c.title = #{title}</if>
|
|
<if test="startDate != null "> and c.start_date = #{startDate}</if>
|
|
<if test="endDate != null "> and c.end_date = #{endDate}</if>
|
|
<if test="address != null and address != ''"> and c.address = #{address}</if>
|
|
<if test="longitude != null "> and c.longitude = #{longitude}</if>
|
|
<if test="latitude != null "> and c.latitude = #{latitude}</if>
|
|
<choose>
|
|
<when test="valid==null or valid==0">and c.valid=0 and date(c.end_date) >=CURRENT_DATE()</when>
|
|
<otherwise>and ( c.valid!=0 or date(c.end_date) < CURRENT_DATE() )</otherwise>
|
|
</choose>
|
|
<if test="range != null "> and c.range = #{range}</if>
|
|
<if test="isAll != null "> and c.is_all = #{isAll}</if>
|
|
<if test="state != null "> and c.state = #{state}</if>
|
|
<if test="groupId!=null">
|
|
and ( (c.is_all=1 and c.valid=0 ) or g.group_id= #{groupId})
|
|
</if>
|
|
<if test="userId!=null">
|
|
and ( (c.is_all=1 and c.valid=0 ) or g.group_id in (SELECT sub_dept_group from pro_project_info_subdepts_users where user_id=#{userId} order by ifnull(update_time,date('2099-12-31')) desc ,create_time desc LIMIT 1) )
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="selectCountByValid" resultType="java.lang.Long" parameterType="Long">
|
|
select count(1) cnt from pro_mobile_attendance_config where is_del=0 and valid=0 and date(end_date) >=CURRENT_DATE() and project_id = #{projectId}
|
|
union
|
|
select count(1) cnt from pro_mobile_attendance_config where is_del=0 and ( valid!=0 or date(end_date) < CURRENT_DATE() ) and project_id = #{projectId}
|
|
</select>
|
|
|
|
<select id="selectProMobileAttendanceConfigById" parameterType="Long" resultMap="ProMobileAttendanceConfigResult">
|
|
<include refid="selectProMobileAttendanceConfigVo"/>
|
|
where c.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertProMobileAttendanceConfig" parameterType="ProMobileAttendanceConfig" useGeneratedKeys="true" keyProperty="id">
|
|
insert into pro_mobile_attendance_config
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="comId != null">com_id,</if>
|
|
<if test="projectId != null">project_id,</if>
|
|
<if test="title != null and title != ''">title,</if>
|
|
<if test="startDate != null">start_date,</if>
|
|
<if test="endDate != null">end_date,</if>
|
|
<if test="address != null">address,</if>
|
|
<if test="longitude != null">longitude,</if>
|
|
<if test="latitude != null">latitude,</if>
|
|
<if test="valid != null">valid,</if>
|
|
<if test="range != null">`range`,</if>
|
|
<if test="isAll != null">is_all,</if>
|
|
<if test="state != null">state,</if>
|
|
<if test="isDel != null">is_del,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="comId != null">#{comId},</if>
|
|
<if test="projectId != null">#{projectId},</if>
|
|
<if test="title != null and title != ''">#{title},</if>
|
|
<if test="startDate != null">#{startDate},</if>
|
|
<if test="endDate != null">#{endDate},</if>
|
|
<if test="address != null">#{address},</if>
|
|
<if test="longitude != null">#{longitude},</if>
|
|
<if test="latitude != null">#{latitude},</if>
|
|
<if test="valid != null">#{valid},</if>
|
|
<if test="range != null">#{range},</if>
|
|
<if test="isAll != null">#{isAll},</if>
|
|
<if test="state != null">#{state},</if>
|
|
<if test="isDel != null">#{isDel},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateProMobileAttendanceConfig" parameterType="ProMobileAttendanceConfig">
|
|
update pro_mobile_attendance_config
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="comId != null">com_id = #{comId},</if>
|
|
<if test="projectId != null">project_id = #{projectId},</if>
|
|
<if test="title != null and title != ''">title = #{title},</if>
|
|
<if test="startDate != null">start_date = #{startDate},</if>
|
|
<if test="endDate != null">end_date = #{endDate},</if>
|
|
<if test="address != null">address = #{address},</if>
|
|
<if test="longitude != null">longitude = #{longitude},</if>
|
|
<if test="latitude != null">latitude = #{latitude},</if>
|
|
<if test="valid != null">valid = #{valid},</if>
|
|
<if test="range != null">`range` = #{range},</if>
|
|
<if test="isAll != null">is_all = #{isAll},</if>
|
|
<if test="state != null">state = #{state},</if>
|
|
<if test="isDel != null">is_del = #{isDel},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteProMobileAttendanceConfigById" parameterType="Long">
|
|
delete from pro_mobile_attendance_config where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteProMobileAttendanceConfigByIds" parameterType="String">
|
|
delete from pro_mobile_attendance_config where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |