135 lines
4.9 KiB
XML
135 lines
4.9 KiB
XML
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.bonus.aqgqj.basis.dao.CustomDao">
|
|
<resultMap type="com.bonus.aqgqj.basis.entity.vo.BaseCustom" id="BaseCustomResult">
|
|
<id property="customId" column="id" />
|
|
<result property="customName" column="custom_name" />
|
|
<result property="deptId" column="dept_id" />
|
|
<result property="pId" column="p_id" />
|
|
<result property="customType" column="custom_type" />
|
|
<result property="customUser" column="custom_user" />
|
|
<result property="customPhone" column="custom_phone" />
|
|
<result property="customStatus" column="custom_status" />
|
|
<result property="createUser" column="create_user" />
|
|
<result property="updateUser" column="update_user" />
|
|
<result property="delFlag" column="del_flag" />
|
|
</resultMap>
|
|
<select id="list" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseCustom" resultMap="BaseCustomResult">
|
|
select id,custom_name,dept_id,p_id,custom_type,custom_user,custom_phone
|
|
from tb_custom
|
|
<where>
|
|
del_flag = 0 and dept_id = 0
|
|
<if test="customName != null and customName != ''">
|
|
and custom_name like concat('%', #{customName}, '%')
|
|
</if>
|
|
</where>
|
|
order by id ASC
|
|
</select>
|
|
|
|
<select id="listDept" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseCustom" resultMap="BaseCustomResult">
|
|
select id,custom_name,dept_id,p_id,custom_type,custom_user,custom_phone
|
|
from tb_custom
|
|
<where>
|
|
del_flag = 0 and dept_id = 1 and p_id = #{pId}
|
|
<if test="customName != null and customName != ''">
|
|
and custom_name like concat('%', #{customName}, '%')
|
|
</if>
|
|
</where>
|
|
order by id ASC
|
|
</select>
|
|
|
|
<select id="getCustomId" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseCustom" resultMap="BaseCustomResult">
|
|
select id,custom_name,p_id,dept_id,custom_type,custom_user,custom_phone
|
|
from tb_custom
|
|
where del_flag=0 and id=#{customId}
|
|
</select>
|
|
|
|
<select id="getCustom" resultMap="BaseCustomResult">
|
|
select id,custom_name,custom_type,custom_user,custom_phone
|
|
from tb_custom
|
|
where custom_name = #{customName} and id != #{customId} and dept_id = 0
|
|
</select>
|
|
|
|
<select id="getDeptCustom" resultMap="BaseCustomResult">
|
|
select id,custom_name,custom_type,custom_user,custom_phone
|
|
from tb_custom
|
|
where custom_name = #{customName} and id != #{customId} and dept_id = 1
|
|
</select>
|
|
|
|
<select id="getCustomPid" resultMap="BaseCustomResult">
|
|
select id,custom_name,p_id,custom_type,custom_user,custom_phone
|
|
from tb_custom
|
|
where p_id = #{pId} and id = #{customId}
|
|
</select>
|
|
|
|
|
|
<select id="getAdd" resultMap="BaseCustomResult">
|
|
select id,custom_name,custom_type,custom_user,custom_phone
|
|
from tb_custom
|
|
where custom_name = #{customName} and dept_id = 0 and del_flag = 0
|
|
</select>
|
|
|
|
<select id="getAddDept" resultMap="BaseCustomResult">
|
|
select id,custom_name,custom_type,custom_user,custom_phone
|
|
from tb_custom
|
|
where custom_name = #{customName} and dept_id = 1 and p_id = #{pId} and del_flag = 0
|
|
</select>
|
|
|
|
<select id="getCustomPhone" resultMap="BaseCustomResult">
|
|
select id,custom_name,custom_type,custom_user,custom_phone
|
|
from tb_custom
|
|
where custom_phone = #{customPhone} and id != #{customId}
|
|
</select>
|
|
|
|
<update id="update">
|
|
update tb_custom
|
|
set custom_name = #{customName},
|
|
custom_type = #{customType},
|
|
custom_user = #{customUser},
|
|
custom_phone = #{customPhone},
|
|
update_time = now()
|
|
where id = #{customId}
|
|
</update>
|
|
|
|
<insert id="add" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseCustom" useGeneratedKeys="true" keyProperty="id,p_id" >
|
|
insert into tb_custom(custom_name,dept_id,custom_type,custom_user,custom_phone,create_time,del_flag
|
|
)values (
|
|
#{customName},0,#{customType},#{customUser},#{customPhone},now(),0
|
|
)
|
|
</insert>
|
|
|
|
<insert id="addDept" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseCustom" >
|
|
insert into tb_custom(custom_name,p_id,dept_id,custom_type,custom_user,custom_phone,create_time,del_flag
|
|
)values (
|
|
#{customName},#{pId},1,#{customType},#{customUser},#{customPhone},now(),0
|
|
)
|
|
</insert>
|
|
|
|
<update id="delCustom">
|
|
update tb_custom
|
|
set del_flag = 1
|
|
where id = #{customId}
|
|
</update>
|
|
|
|
<update id="updateCustomStatus" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseCustom" >
|
|
update tb_custom set custom_status=#{customStatus} where id=#{customId}
|
|
</update>
|
|
|
|
<select id="customList" resultType="com.bonus.aqgqj.basis.entity.vo.BaseCustom">
|
|
select id,p_id AS pId,custom_name AS customName
|
|
from tb_custom
|
|
where dept_id = 0 and custom_name is not null and custom_name !='' and del_flag = 0
|
|
group by custom_name
|
|
</select>
|
|
|
|
|
|
<select id="getCustomNewId" resultType="Long">
|
|
select id
|
|
from tb_custom
|
|
where dept_id = 0 and custom_name = #{customName} and dept_id = 0
|
|
</select>
|
|
|
|
<update id="updatePid" parameterType="Long" >
|
|
update tb_custom set p_id=#{id} where id=#{id} and dept_id = 0
|
|
</update>
|
|
</mapper> |