12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?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.liang.dao.PrjProjectroleDao">
- <resultMap type="com.liang.entity.PrjProjectrole" id="PrjProjectroleMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="mc" column="MC" jdbcType="VARCHAR"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="PrjProjectroleMap">
- select ID,
- MC
- from prj_projectRole
- where ID = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="PrjProjectroleMap">
- select
- ID, MC
- from prj_projectRole
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="mc != null and mc != ''">
- and MC = #{mc}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from prj_projectRole
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="mc != null and mc != ''">
- and MC = #{mc}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into prj_projectRole(MC)
- values (#{mc})
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into prj_projectRole(MC)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.mc})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into prj_projectRole(MC)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.mc})
- </foreach>
- on duplicate key update
- MC = values(MC)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update prj_projectRole
- <set>
- <if test="mc != null and mc != ''">
- MC = #{mc}
- </if>
- </set>
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete
- from prj_projectRole
- where ID = #{id}
- </delete>
- <!--获取项目角色-->
- <select id="getProjectRole" resultType="map">
- select CONVERT(varchar (255), id) as code, MC as name
- from prj_projectRole
- </select>
- </mapper>
|