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

77 lines
2.8 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.TeamDao">
<resultMap type="com.bonus.aqgqj.basis.entity.vo.BaseTeam" id="BaseTeamResult">
<id property="teamId" column="id" />
<result property="teamName" column="team_name" />
<result property="teamTypeName" column="team_type_name" />
<result property="teamLeader" column="team_leader" />
<result property="teamLeaderPhone" column="team_leader_phone" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
</resultMap>
<select id="list" parameterType="String" resultMap="BaseTeamResult">
select id,team_name,team_type_name,team_leader,team_leader_phone,create_time,update_time
from tb_team
<where>
del_flag = 0
<if test="keyWord != null and keyWord != ''">
and (
INSTR(team_name,#{keyWord}) > 0 OR
INSTR(team_type_name,#{keyWord}) > 0 OR
INSTR(team_leader,#{keyWord}) > 0 OR
INSTR(team_leader_phone,#{keyWord}) > 0
)
</if>
</where>
order by id asc
</select>
<select id="getTeamId" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseTeam" resultMap="BaseTeamResult">
select id,team_name,team_type_name,team_leader,team_leader_phone,create_time,update_time
from tb_team
where del_flag=0 and id=#{teamId}
</select>
<select id="getTeam" resultMap="BaseTeamResult">
select id,team_name,team_type_name,team_leader,team_leader_phone,create_time,update_time
from tb_team
where team_name = #{teamName} and id != #{teamId}
</select>
<select id="getAdd" resultMap="BaseTeamResult">
select id,team_name,team_type_name,team_leader,team_leader_phone,create_time,update_time
from tb_team
where team_name = #{teamName}
</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_team
set team_name = #{teamName},
team_type_name = #{teamTypeName},
team_leader = #{teamLeader},
team_leader_phone = #{teamLeaderPhone},
update_time = now()
where id = #{teamId}
</update>
<insert id="add" parameterType="com.bonus.aqgqj.basis.entity.vo.BaseTeam" >
insert into tb_team(team_name,team_type_name,team_leader,team_leader_phone,create_time,del_flag
)values (
#{teamName},#{teamTypeName},#{teamLeader},#{teamLeaderPhone},now(),0
)
</insert>
<update id="delTeam">
update tb_team
set del_flag = 1
where id = #{teamId}
</update>
</mapper>