| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <!--根据农户姓名和手机号获取水卡列表记录数,应用程序使用--> |
| | | <select id="getCardsByClientNameAndPhoneCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON card.clientId = cli.id |
| | | <where> |
| | | card.state = 1 |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "phone != null and phone !=''"> |
| | | AND cli.phone like CONCAT('%',#{phone},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <!--根据农户姓名和手机号获取水卡列表,应用程序使用--> |
| | | <select id="getCardsByClientNameAndPhone" resultType="com.dy.pipIrrGlobal.voSe.VoCards2"> |
| | | SELECT |
| | | card.id AS clientCardId, |
| | | cli.id AS clientId, |
| | | cli.clientNum, |
| | | cli.name AS clientName, |
| | | card.cardNum, |
| | | cli.phone, |
| | | cli.idCard, |
| | | card.state AS cardState, |
| | | (CASE |
| | | WHEN card.state = 1 THEN '正常' |
| | | WHEN card.state = 2 THEN '已注销' |
| | | WHEN card.state = 3 THEN '已挂失' |
| | | End) AS stateName, |
| | | '农户卡' AS cardType, |
| | | FORMAT(card.money, 2) AS money |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON card.clientId = cli.id |
| | | <where> |
| | | card.state = 1 |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "phone != null and phone !=''"> |
| | | AND cli.phone like CONCAT('%',#{phone},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY card.id |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | <!--根据农户ID查询正常状态的水卡列表,小程序使用--> |
| | | <select id="getCardsByClientID" resultType="com.dy.pipIrrGlobal.voWe.VoCards3"> |
| | | SELECT |
| | | card.id AS clientCardId, |
| | | cli.id AS clientId, |
| | | cli.clientNum, |
| | | cli.name AS clientName, |
| | | card.cardNum, |
| | | cli.phone, |
| | | cli.idCard, |
| | | card.state AS cardState, |
| | | (CASE |
| | | WHEN card.state = 1 THEN '正常' |
| | | WHEN card.state = 2 THEN '已注销' |
| | | WHEN card.state = 3 THEN '已挂失' |
| | | End) AS stateName, |
| | | '农户卡' AS cardType, |
| | | FORMAT(card.money, 2) AS money |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON card.clientId = cli.id |
| | | where |
| | | card.state = 1 |
| | | AND cli.id like CONCAT('%',#{clientId},'%') |
| | | |
| | | |
| | | ORDER BY card.id |
| | | </select> |
| | | </mapper> |