| New file | 
|  |  |  | 
|---|
|  |  |  | <?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.dy.pipIrrGlobal.daoIr.IrCropMapper"> | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrCrop"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | <!--@Table ir_crop--> | 
|---|
|  |  |  | <id column="id" jdbcType="BIGINT" property="id" /> | 
|---|
|  |  |  | <result column="crop_name" jdbcType="VARCHAR" property="cropName" /> | 
|---|
|  |  |  | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> | 
|---|
|  |  |  | <result column="deleted" jdbcType="TINYINT" property="deleted" /> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | id, crop_name, remarks, deleted | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <!--添加--> | 
|---|
|  |  |  | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrCrop"> | 
|---|
|  |  |  | insert into ir_crop | 
|---|
|  |  |  | <trim prefix="(" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="cropName != null"> | 
|---|
|  |  |  | crop_name, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="remarks != null"> | 
|---|
|  |  |  | remarks, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="deleted != null"> | 
|---|
|  |  |  | deleted, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | #{id,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="cropName != null"> | 
|---|
|  |  |  | #{cropName,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="remarks != null"> | 
|---|
|  |  |  | #{remarks,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="deleted != null"> | 
|---|
|  |  |  | #{deleted,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | <!--逻辑删除--> | 
|---|
|  |  |  | <delete id="deleteLogicById" parameterType="java.lang.Long"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update ir_crop | 
|---|
|  |  |  | set deleted = 1 | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--修改信息--> | 
|---|
|  |  |  | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrCrop"> | 
|---|
|  |  |  | update ir_crop | 
|---|
|  |  |  | <set> | 
|---|
|  |  |  | <if test="cropName != null"> | 
|---|
|  |  |  | crop_name = #{cropName,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="remarks != null"> | 
|---|
|  |  |  | remarks = #{remarks,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="deleted != null"> | 
|---|
|  |  |  | deleted = #{deleted,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </set> | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="getRecordCount" resultType="java.lang.Long"> | 
|---|
|  |  |  | SELECT COUNT(*) AS recordCount | 
|---|
|  |  |  | FROM ir_crop cro | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | cro.deleted = 0 | 
|---|
|  |  |  | <if test="cropName != null and cropName != ''"> | 
|---|
|  |  |  | AND cro.crop_name LIKE CONCAT('%', #{cropName}, '%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="getCrops" resultType="com.dy.pipIrrGlobal.voIr.VoCrop"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | CAST(cro.id AS char)AS id, | 
|---|
|  |  |  | cro.crop_name  AS  cropName, | 
|---|
|  |  |  | cro.remarks | 
|---|
|  |  |  | FROM ir_crop cro | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | cro.deleted = 0 | 
|---|
|  |  |  | <if test="cropName != null and cropName != ''"> | 
|---|
|  |  |  | AND cro.crop_name LIKE CONCAT('%', #{cropName}, '%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | <if test="pageCurr != null and pageSize != null"> | 
|---|
|  |  |  | LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectById" resultType="com.dy.pipIrrGlobal.voIr.VoCropOne"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | CAST(cro.id AS char)AS id, | 
|---|
|  |  |  | cro.crop_name  AS  cropName, | 
|---|
|  |  |  | cro.remarks | 
|---|
|  |  |  | from ir_crop cro | 
|---|
|  |  |  | where cro.id = #{id,jdbcType=BIGINT} and cro.deleted = 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </mapper> | 
|---|