ah_sz_gqj/src/main/resources/mappers/basis/CustomMapper.xml

78 lines
2.9 KiB
XML
Raw Normal View History

<!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="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,custom_type,custom_user,custom_phone,custom_status
from tb_custom
<where>
del_flag = 0
<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,custom_type,custom_user,custom_phone,custom_status
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,custom_status
from tb_custom
where custom_name = #{customName} and id != #{customId}
</select>
<select id="getAdd" resultMap="BaseCustomResult">
select id,custom_name,custom_type,custom_user,custom_phone,custom_status
from tb_custom
where custom_name = #{customName}
</select>
<select id="getCustomPhone" resultMap="BaseCustomResult">
select id,custom_name,custom_type,custom_user,custom_phone,custom_status
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},
custom_status = #{customStatus},
update_time = now()
where id = #{customId}
</update>
<insert id="add" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseCustom" >
insert into tb_custom(custom_name,custom_type,custom_user,custom_phone,custom_status,create_time,del_flag
)values (
#{customName},#{customType},#{customUser},#{customPhone},#{customStatus},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>
</mapper>