123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 |
- <?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.chinaitop.depot.intelligent.grainsituation.mapper.TCcvalueMapper" >
- <resultMap id="BaseResultMap" type="com.chinaitop.depot.intelligent.grainsituation.model.TCcvalue" >
- <result column="id" property="id" jdbcType="VARCHAR" />
- <result column="org_id" property="orgId" jdbcType="VARCHAR" />
- <result column="v_cc_code" property="vCcCode" jdbcType="VARCHAR" />
- <result column="z_zd_code" property="zZdCode" jdbcType="VARCHAR" />
- <result column="v_cf_code" property="vCfCode" jdbcType="VARCHAR" />
- <result column="v_max" property="vMax" jdbcType="INTEGER" />
- <result column="v_min" property="vMin" jdbcType="INTEGER" />
- <result column="v_avg" property="vAvg" jdbcType="DECIMAL" />
- <result column="v_update_time" property="vUpdateTime" jdbcType="TIMESTAMP" />
- <result column="data_source" property="dataSource" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="Example_Where_Clause" >
- <where >
- <foreach collection="oredCriteria" item="criteria" separator="or" >
- <if test="criteria.valid" >
- <trim prefix="(" suffix=")" prefixOverrides="and" >
- <foreach collection="criteria.criteria" item="criterion" >
- <choose >
- <when test="criterion.noValue" >
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue" >
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue" >
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue" >
- and ${criterion.condition}
- <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Update_By_Example_Where_Clause" >
- <where >
- <foreach collection="example.oredCriteria" item="criteria" separator="or" >
- <if test="criteria.valid" >
- <trim prefix="(" suffix=")" prefixOverrides="and" >
- <foreach collection="criteria.criteria" item="criterion" >
- <choose >
- <when test="criterion.noValue" >
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue" >
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue" >
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue" >
- and ${criterion.condition}
- <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Base_Column_List" >
- id, org_id, v_cc_code, z_zd_code, v_cf_code, v_max, v_min, v_avg, v_update_time,
- data_source
- </sql>
- <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TCcvalueExample" >
- select
- <if test="distinct" >
- distinct
- </if>
- <include refid="Base_Column_List" />
- from t_ccvalue
- <if test="_parameter != null" >
- <include refid="Example_Where_Clause" />
- </if>
- <if test="orderByClause != null" >
- order by ${orderByClause}
- </if>
- </select>
- <delete id="deleteByExample" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TCcvalueExample" >
- delete from t_ccvalue
- <if test="_parameter != null" >
- <include refid="Example_Where_Clause" />
- </if>
- </delete>
- <insert id="insert" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TCcvalue" >
- insert into t_ccvalue (id, org_id, v_cc_code,
- z_zd_code, v_cf_code, v_max,
- v_min, v_avg, v_update_time,
- data_source,hcjcdh)
- values (#{id,jdbcType=VARCHAR}, #{orgId,jdbcType=VARCHAR}, #{vCcCode,jdbcType=VARCHAR},
- #{zZdCode,jdbcType=VARCHAR}, #{vCfCode,jdbcType=VARCHAR}, #{vMax,jdbcType=INTEGER},
- #{vMin,jdbcType=INTEGER}, #{vAvg,jdbcType=DECIMAL}, #{vUpdateTime,jdbcType=TIMESTAMP},
- #{dataSource,jdbcType=VARCHAR}, #{hcjcdh,jdbcType=VARCHAR})
- </insert>
- <insert id="insertSelective" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TCcvalue" >
- insert into t_ccvalue
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- id,
- </if>
- <if test="orgId != null" >
- org_id,
- </if>
- <if test="vCcCode != null" >
- v_cc_code,
- </if>
- <if test="zZdCode != null" >
- z_zd_code,
- </if>
- <if test="vCfCode != null" >
- v_cf_code,
- </if>
- <if test="vMax != null" >
- v_max,
- </if>
- <if test="vMin != null" >
- v_min,
- </if>
- <if test="vAvg != null" >
- v_avg,
- </if>
- <if test="vUpdateTime != null" >
- v_update_time,
- </if>
- <if test="dataSource != null" >
- data_source,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="orgId != null" >
- #{orgId,jdbcType=VARCHAR},
- </if>
- <if test="vCcCode != null" >
- #{vCcCode,jdbcType=VARCHAR},
- </if>
- <if test="zZdCode != null" >
- #{zZdCode,jdbcType=VARCHAR},
- </if>
- <if test="vCfCode != null" >
- #{vCfCode,jdbcType=VARCHAR},
- </if>
- <if test="vMax != null" >
- #{vMax,jdbcType=INTEGER},
- </if>
- <if test="vMin != null" >
- #{vMin,jdbcType=INTEGER},
- </if>
- <if test="vAvg != null" >
- #{vAvg,jdbcType=DECIMAL},
- </if>
- <if test="vUpdateTime != null" >
- #{vUpdateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="dataSource != null" >
- #{dataSource,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <select id="countByExample" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TCcvalueExample" resultType="java.lang.Integer" >
- select count(*) from t_ccvalue
- <if test="_parameter != null" >
- <include refid="Example_Where_Clause" />
- </if>
- </select>
- <update id="updateByExampleSelective" parameterType="map" >
- update t_ccvalue
- <set >
- <if test="record.id != null" >
- id = #{record.id,jdbcType=VARCHAR},
- </if>
- <if test="record.orgId != null" >
- org_id = #{record.orgId,jdbcType=VARCHAR},
- </if>
- <if test="record.vCcCode != null" >
- v_cc_code = #{record.vCcCode,jdbcType=VARCHAR},
- </if>
- <if test="record.zZdCode != null" >
- z_zd_code = #{record.zZdCode,jdbcType=VARCHAR},
- </if>
- <if test="record.vCfCode != null" >
- v_cf_code = #{record.vCfCode,jdbcType=VARCHAR},
- </if>
- <if test="record.vMax != null" >
- v_max = #{record.vMax,jdbcType=INTEGER},
- </if>
- <if test="record.vMin != null" >
- v_min = #{record.vMin,jdbcType=INTEGER},
- </if>
- <if test="record.vAvg != null" >
- v_avg = #{record.vAvg,jdbcType=DECIMAL},
- </if>
- <if test="record.vUpdateTime != null" >
- v_update_time = #{record.vUpdateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="record.dataSource != null" >
- data_source = #{record.dataSource,jdbcType=VARCHAR},
- </if>
- </set>
- <if test="_parameter != null" >
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByExample" parameterType="map" >
- update t_ccvalue
- set id = #{record.id,jdbcType=VARCHAR},
- org_id = #{record.orgId,jdbcType=VARCHAR},
- v_cc_code = #{record.vCcCode,jdbcType=VARCHAR},
- z_zd_code = #{record.zZdCode,jdbcType=VARCHAR},
- v_cf_code = #{record.vCfCode,jdbcType=VARCHAR},
- v_max = #{record.vMax,jdbcType=INTEGER},
- v_min = #{record.vMin,jdbcType=INTEGER},
- v_avg = #{record.vAvg,jdbcType=DECIMAL},
- v_update_time = #{record.vUpdateTime,jdbcType=TIMESTAMP},
- data_source = #{record.dataSource,jdbcType=VARCHAR}
- <if test="_parameter != null" >
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <insert id="insertBatch" parameterType="java.util.List">
- insert into t_ccvalue (id, org_id, v_cc_code,
- z_zd_code, v_cf_code, v_max,
- v_min, v_avg, v_update_time,
- data_source,hcjcdh)
- values
- <foreach collection="list" item="cc" index="index" separator=",">
- (#{cc.id,jdbcType=VARCHAR}, #{cc.orgId,jdbcType=VARCHAR}, #{cc.vCcCode,jdbcType=VARCHAR},
- #{cc.zZdCode,jdbcType=VARCHAR}, #{cc.vCfCode,jdbcType=VARCHAR}, #{cc.vMax,jdbcType=INTEGER},
- #{cc.vMin,jdbcType=INTEGER}, #{cc.vAvg,jdbcType=DECIMAL}, #{cc.vUpdateTime,jdbcType=TIMESTAMP},
- #{cc.dataSource,jdbcType=VARCHAR}, #{cc.hcjcdh,jdbcType=VARCHAR})
- </foreach>
- </insert>
- <select id="getByCfCode" resultType="java.util.Map" parameterType="java.util.Map">
- SELECT
- v_cf_code AS vCfCode,
- v_max AS max,
- v_min AS min,
- v_avg AS avg,
- v_update_time AS vUpdateTime
- FROM
- t_ccvalue
- <where>
- <if test="vCfCode != null">
- v_cf_code = #{vCfCode}
- </if>
- <if test="searchStartDate != null and test=searchEndDate != null">
- AND v_update_time BETWEEN #{searchStartDate} AND #{searchEndDate}
- </if>
- </where>
- GROUP BY vUpdateTime
- ORDER BY vUpdateTime asc
- </select>
- <select id="getByCfCodes" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT
- a.*
- FROM
- (
- SELECT
- v_cf_code AS vCfCode,
- v_max AS max,
- v_min AS min,
- v_avg AS avg,
- v_update_time AS vUpdateTime
- FROM
- t_ccvalue
- ORDER BY
- vUpdateTime DESC
- ) a
- WHERE 1=1
- <if test="orgId != null">
- AND a.orgId = #{orgId}
- </if>
- GROUP BY
- a.vCfCode;
- </select>
- <select id="getOneByCfCode" resultMap="BaseResultMap" parameterType="java.util.Map">
- SELECT
- *
- FROM
- t_ccvalue
- <where>
- <if test="orgId != null">
- org_id = #{orgId} and
- </if>
- <if test="vCfCode != null">
- v_cf_code = #{vCfCode}
- </if>
- </where>
- GROUP BY v_update_time
- ORDER BY v_update_time DESC LIMIT 0,1
- </select>
-
- <select id="getJcd" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT
- concat(credit_code,LPAD(org_id, 3, 0),LPAD(#{vcfcode}, 4, 0),DATE_FORMAT(STR_TO_DATE(#{updateTime},'%Y-%m-%d %H:%i:%s'),'%Y%m%d%H%i'),'00000') jcd
- FROM
- org_info
- <where>
- <if test="orgId != null">
- org_id = #{orgId}
- </if>
- </where>
- </select>
-
- </mapper>
|