| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?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.goafanti.common.dao.PublicAssistAdviceMapper">
- <resultMap type="com.goafanti.common.model.PublicAssistAdvice" id="PublicAssistAdviceMap">
- <result property="id" column="id" jdbcType="INTEGER"/>
- <result property="prid" column="prid" jdbcType="INTEGER"/>
- <result property="aid" column="aid" jdbcType="VARCHAR"/>
- <result property="aname" column="aname" jdbcType="VARCHAR"/>
- <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="PublicAssistAdviceMap">
- select
- id, prid, aid, aname, remarks, create_time
- from public_assist_advice
- where id = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="findPublicAssistAdviceList" resultMap="PublicAssistAdviceMap">
- select
- id, prid, aid, aname, remarks, create_time
- from public_assist_advice
- <where>
- <if test="id != null">
- and id = #{id}
- </if>
- <if test="prid != null">
- and prid = #{prid}
- </if>
- <if test="aid != null and aid != ''">
- and aid = #{aid}
- </if>
- <if test="aname != null and aname != ''">
- and aname = #{aname}
- </if>
- <if test="remarks != null and remarks != ''">
- and remarks = #{remarks}
- </if>
- <if test="createTime != null">
- and create_time = #{createTime}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="findPublicAssistAdviceCount" resultType="java.lang.Integer">
- select count(1)
- from public_assist_advice
- <where>
- <if test="id != null">
- and id = #{id}
- </if>
- <if test="prid != null">
- and prid = #{prid}
- </if>
- <if test="aid != null and aid != ''">
- and aid = #{aid}
- </if>
- <if test="aname != null and aname != ''">
- and aname = #{aname}
- </if>
- <if test="remarks != null and remarks != ''">
- and remarks = #{remarks}
- </if>
- <if test="createTime != null">
- and create_time = #{createTime}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into public_assist_advice(prid, aid, aname, remarks)
- values (#{prid}, #{aid}, #{aname}, #{remarks})
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into public_assist_advice(prid, aid, aname, remarks, create_time)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.prid}, #{entity.aid}, #{entity.aname}, #{entity.remarks}, #{entity.createTime})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into public_assist_advice(prid, aid, aname, remarks, create_time)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.prid}, #{entity.aid}, #{entity.aname}, #{entity.remarks}, #{entity.createTime})
- </foreach>
- on duplicate key update
- prid = values(prid),
- aid = values(aid),
- aname = values(aname),
- remarks = values(remarks),
- create_time = values(create_time)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update public_assist_advice
- <set>
- <if test="prid != null">
- prid = #{prid},
- </if>
- <if test="aid != null and aid != ''">
- aid = #{aid},
- </if>
- <if test="aname != null and aname != ''">
- aname = #{aname},
- </if>
- <if test="remarks != null and remarks != ''">
- remarks = #{remarks},
- </if>
- <if test="createTime != null">
- create_time = #{createTime},
- </if>
- </set>
- where id = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete from public_assist_advice where id = #{id}
- </delete>
- <select id="selectList" resultType="com.goafanti.common.model.PublicAssistAdvice">
- select
- a.id, a.prid, a.aid, a.aname, a.remarks, a.create_time as createTime
- from public_assist_advice a
- <if test="type ==0">
- left join public_release b on a.prid=b.id
- where b.type=3 and b.id = #{id}
- </if>
- <if test="type ==1">
- left join public_release b on a.prid=b.id
- left join public_release c on b.main_id=c.id
- where b.type=3 and c.id = #{id}
- </if>
- </select>
- </mapper>
|