TCorpsMapper.xml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.basicData.mapper.TCorpsMapper">
  6. <resultMap type="TCorps" id="TCorpsResult">
  7. <result property="fId" column="f_id" />
  8. <result property="fPid" column="f_pid" />
  9. <result property="fTypeid" column="f_typeid" />
  10. <result property="fNo" column="f_no" />
  11. <result property="fName" column="f_name" />
  12. <result property="fCname" column="f_cname" />
  13. <result property="fEname" column="f_ename" />
  14. <result property="fTel" column="f_tel" />
  15. <result property="fFax" column="f_fax" />
  16. <result property="fEmail" column="f_email" />
  17. <result property="fManage" column="f_manage" />
  18. <result property="fAddr" column="f_addr" />
  19. <result property="fEaddr" column="f_eaddr" />
  20. <result property="fScale" column="f_scale" />
  21. <result property="fProvince" column="f_province" />
  22. <result property="fCity" column="f_city" />
  23. <result property="fStltypeid" column="f_stltypeid" />
  24. <result property="fStldays" column="f_stldays" />
  25. <result property="fContractno" column="f_contractno" />
  26. <result property="fContractb" column="f_contractb" />
  27. <result property="fContracte" column="f_contracte" />
  28. <result property="fTax" column="f_tax" />
  29. <result property="fInvtel" column="f_invtel" />
  30. <result property="fInvaddr" column="f_invaddr" />
  31. <result property="fBankno" column="f_bankno" />
  32. <result property="fBankname" column="f_bankname" />
  33. <result property="fUbankno" column="f_ubankno" />
  34. <result property="fUbankname" column="f_ubankname" />
  35. <result property="fStatus" column="f_status" />
  36. <result property="fStatusString" column="f_status_string" />
  37. <result property="delFlag" column="del_flag" />
  38. <result property="createBy" column="create_by" />
  39. <result property="createTime" column="create_time" />
  40. <result property="updateBy" column="update_by" />
  41. <result property="updateTime" column="update_time" />
  42. <result property="remark" column="remark" />
  43. <result property="fTypename" column="f_typename" />
  44. <result property="loginAccount" column="login_account" />
  45. <result property="creditLv" column="credit_lv" />
  46. <result property="paymentDays" column="payment_days" />
  47. <result property="carNum" column="car_num" />
  48. <result property="headOffice" column="head_office" />
  49. <result property="registerdCapital" column="registerd_capital" />
  50. <result property="legalPerson" column="legal_person" />
  51. <result property="insdustry" column="insdustry" />
  52. <result property="creditNum" column="credit_num" />
  53. <result property="taxpayerNum" column="taxpayer_num" />
  54. <result property="industryCommerceNum" column="industry_commerce_num" />
  55. <result property="organizationNum" column="organization_num" />
  56. <result property="registerOrganization" column="register_organization" />
  57. <result property="dateOfEstablishment" column="date_of_establishment" />
  58. <result property="companyType" column="company_type" />
  59. <result property="businessDeadline" column="business_deadline" />
  60. <result property="businessArea" column="business_area" />
  61. <result property="annualDate" column="annual_date" />
  62. <result property="registerdAddress" column="registerd_address" />
  63. <result property="manageScope" column="manage_scope" />
  64. <result property="deptId" column="dept_id" />
  65. <result property="uscc" column="uscc" />
  66. </resultMap>
  67. <sql id="selectTCorpsVo">
  68. select f_id, f_pid, f_typeid, f_no, f_name, f_cname, f_ename, f_tel, f_fax, f_email, f_manage, f_addr, f_eaddr, f_scale, f_province,
  69. f_city, f_stltypeid, f_stldays, f_contractno, f_contractb, f_contracte, f_tax, f_invtel, f_invaddr, f_bankno, f_bankname, f_ubankno,
  70. f_ubankname, f_status,
  71. CASE
  72. WHEN f_status = 0 THEN '正常'
  73. WHEN f_status = 1 THEN '停用'
  74. END as f_status_string
  75. , del_flag, create_by, create_time, update_by, update_time, remark, f_typename, login_account, credit_lv,
  76. payment_days, car_num, head_office, registerd_capital, legal_person, insdustry, credit_num, taxpayer_num, industry_commerce_num,
  77. organization_num, register_organization, date_of_establishment, company_type, business_deadline, business_area, annual_date,
  78. registerd_address, manage_scope, dept_id, uscc from t_corps
  79. </sql>
  80. <select id="selectTCorpsList" parameterType="TCorps" resultMap="TCorpsResult">
  81. <include refid="selectTCorpsVo"/>
  82. <where>
  83. <if test="fTypeid != null and fTypeid != ''"> and JSON_CONTAINS( f_typeid -> '$[*]', #{fTypeid}, '$')</if>
  84. <if test="fTypeid == null and fTypeid == ''"> and f_typeid != '[\"100\"]' and f_typeid != '[\"102\"]'</if>
  85. <if test="fPid != null and fPid != ''"> and f_pid = #{fPid}</if>
  86. <if test="fNo != null and fNo != ''"> and f_no = #{fNo}</if>
  87. <if test="fName != null and fName != ''"> and f_name like concat('%', #{fName}, '%')</if>
  88. <if test="fCname != null and fCname != ''"> and f_cname like concat('%', #{fCname}, '%')</if>
  89. <if test="fEname != null and fEname != ''"> and f_ename like concat('%', #{fEname}, '%')</if>
  90. <if test="fTel != null and fTel != ''"> and f_tel = #{fTel}</if>
  91. <if test="fFax != null and fFax != ''"> and f_fax = #{fFax}</if>
  92. <if test="fEmail != null and fEmail != ''"> and f_email = #{fEmail}</if>
  93. <if test="fManage != null and fManage != ''"> and f_manage = #{fManage}</if>
  94. <if test="fAddr != null and fAddr != ''"> and f_addr = #{fAddr}</if>
  95. <if test="fEaddr != null and fEaddr != ''"> and f_eaddr = #{fEaddr}</if>
  96. <if test="fScale != null and fScale != ''"> and f_scale = #{fScale}</if>
  97. <if test="fProvince != null and fProvince != ''"> and f_province = #{fProvince}</if>
  98. <if test="fCity != null and fCity != ''"> and f_city = #{fCity}</if>
  99. <if test="fStltypeid != null "> and f_stltypeid = #{fStltypeid}</if>
  100. <if test="fStldays != null "> and f_stldays = #{fStldays}</if>
  101. <if test="fContractno != null and fContractno != ''"> and f_contractno = #{fContractno}</if>
  102. <if test="fContractb != null "> and f_contractb = #{fContractb}</if>
  103. <if test="fContracte != null "> and f_contracte = #{fContracte}</if>
  104. <if test="fTax != null and fTax != ''"> and f_tax = #{fTax}</if>
  105. <if test="fInvtel != null and fInvtel != ''"> and f_invtel = #{fInvtel}</if>
  106. <if test="fInvaddr != null and fInvaddr != ''"> and f_invaddr = #{fInvaddr}</if>
  107. <if test="fBankno != null and fBankno != ''"> and f_bankno = #{fBankno}</if>
  108. <if test="fBankname != null and fBankname != ''"> and f_bankname like concat('%', #{fBankname}, '%')</if>
  109. <if test="fUbankno != null and fUbankno != ''"> and f_ubankno = #{fUbankno}</if>
  110. <if test="fUbankname != null and fUbankname != ''"> and f_ubankname like concat('%', #{fUbankname}, '%')</if>
  111. <if test="fStatus != null and fStatus != ''"> and f_status = #{fStatus}</if>
  112. <if test="fTypename != null and fTypename != ''"> and f_typename like concat('%', #{fTypename}, '%')</if>
  113. <if test="loginAccount != null and loginAccount != ''"> and login_account = #{loginAccount}</if>
  114. <if test="creditLv != null and creditLv != ''"> and credit_lv = #{creditLv}</if>
  115. <if test="paymentDays != null "> and payment_days = #{paymentDays}</if>
  116. <if test="carNum != null "> and car_num = #{carNum}</if>
  117. <if test="headOffice != null and headOffice != ''"> and head_office = #{headOffice}</if>
  118. <if test="registerdCapital != null and registerdCapital != ''"> and registerd_capital = #{registerdCapital}</if>
  119. <if test="legalPerson != null and legalPerson != ''"> and legal_person = #{legalPerson}</if>
  120. <if test="insdustry != null and insdustry != ''"> and insdustry = #{insdustry}</if>
  121. <if test="creditNum != null and creditNum != ''"> and credit_num = #{creditNum}</if>
  122. <if test="taxpayerNum != null and taxpayerNum != ''"> and taxpayer_num = #{taxpayerNum}</if>
  123. <if test="industryCommerceNum != null and industryCommerceNum != ''"> and industry_commerce_num = #{industryCommerceNum}</if>
  124. <if test="organizationNum != null and organizationNum != ''"> and organization_num = #{organizationNum}</if>
  125. <if test="registerOrganization != null and registerOrganization != ''"> and register_organization = #{registerOrganization}</if>
  126. <if test="dateOfEstablishment != null "> and date_of_establishment = #{dateOfEstablishment}</if>
  127. <if test="companyType != null and companyType != ''"> and company_type = #{companyType}</if>
  128. <if test="businessDeadline != null "> and business_deadline = #{businessDeadline}</if>
  129. <if test="businessArea != null and businessArea != ''"> and business_area = #{businessArea}</if>
  130. <if test="annualDate != null "> and annual_date = #{annualDate}</if>
  131. <if test="registerdAddress != null and registerdAddress != ''"> and registerd_address = #{registerdAddress}</if>
  132. <if test="manageScope != null and manageScope != ''"> and manage_scope = #{manageScope}</if>
  133. </where>
  134. ORDER BY CONVERT(f_name USING gbk) asc
  135. </select>
  136. <select id="selectAgreementCorpList" parameterType="TCorps" resultType="map">
  137. select
  138. corp.f_id AS fId,
  139. corp.f_name AS fName
  140. FROM
  141. t_warehouse_agreement agre
  142. LEFT JOIN t_corps corp ON corp.f_id = agre.f_corpid
  143. <where>
  144. agre.f_status = '0'
  145. <if test="fName != null and fName != ''"> and corp.f_name like concat('%', #{fName}, '%')</if>
  146. </where>
  147. GROUP BY corp.f_name
  148. ORDER BY CONVERT(corp.f_name USING gbk) asc
  149. </select>
  150. <select id="selectAgreementCorpListNoData" parameterType="TCorps" resultType="map">
  151. select
  152. corp.f_id AS fId,
  153. corp.f_name AS fName
  154. FROM
  155. t_warehouse_agreement agre
  156. LEFT JOIN t_corps corp ON corp.f_id = agre.f_corpid
  157. where
  158. agre.f_status = '0'
  159. GROUP BY corp.f_name
  160. ORDER BY CONVERT(corp.f_name USING gbk) asc
  161. </select>
  162. <select id="selectTCorpsById" parameterType="Long" resultMap="TCorpsResult">
  163. <include refid="selectTCorpsVo"/>
  164. where f_id = #{fId} and del_flag = '0'
  165. </select>
  166. <select id="selectCorpList" parameterType="long" resultMap="TCorpsResult">
  167. SELECT
  168. c.f_id,
  169. c.f_pid,
  170. c.f_typeid,
  171. c.f_no,
  172. c.f_name
  173. FROM
  174. t_corps c
  175. LEFT JOIN F_TMSORDERBILLSCARS car ON car.driver_tel = c.f_tel OR car.corp_id = c.f_id
  176. WHERE
  177. c.f_typeid != '[\"102\"]'
  178. OR car.id = #{fId}
  179. </select>
  180. <select id="selectCustomerDriverList" parameterType="TCorps" resultMap="TCorpsResult">
  181. SELECT DISTINCT
  182. c.f_id,
  183. c.f_pid,
  184. c.f_typeid,
  185. c.f_no,
  186. c.f_name
  187. FROM
  188. t_corps c
  189. LEFT JOIN F_TMSORDERBILLSCARS car ON car.driver_tel = c.f_tel
  190. <where>
  191. c.f_status = '0'
  192. <if test="fName != null and fName != ''"> and c.f_name like concat('%', #{fName}, '%')</if>
  193. </where>
  194. </select>
  195. <select id="selectFleetDriverMsgListMap" parameterType="TCorps" resultType="Map">
  196. SELECT
  197. c.f_id AS id,
  198. t.f_name AS companyName,
  199. c.f_name AS name,
  200. c.f_fax AS fFax,
  201. c.f_contractb AS fContractb,
  202. c.f_eaddr AS fEaddr,
  203. c.f_contracte AS fContracte,
  204. c.f_scale AS fScale,
  205. c.f_tel AS fTel,
  206. c.f_addr AS fAddr,
  207. c.registerd_address AS registerdAddress,
  208. c.manage_scope AS manageScope,
  209. c.create_time AS creatTime,
  210. c.update_time AS updateTime,
  211. c.f_status AS fStatus,
  212. c.del_flag AS delFlag,
  213. c.create_by AS createBy,
  214. c.update_by AS updateBy,
  215. c.update_time AS updateTime,
  216. c.remark AS remark
  217. FROM
  218. t_corps c
  219. LEFT JOIN t_corps t ON t.f_id = c.f_pid
  220. <where>
  221. <if test="fTypeid != null and fTypeid != ''"> and c.f_typeid = #{fTypeid}</if>
  222. <if test="fPid != null and fPid != ''"> and c.f_pid = #{fPid}</if>
  223. <if test="fNo != null and fNo != ''"> and c.f_no = #{fNo}</if>
  224. <if test="fName != null and fName != ''"> and c.f_name like concat('%', #{fName}, '%')</if>
  225. <if test="fCname != null and fCname != ''"> and c.f_cname like concat('%', #{fCname}, '%')</if>
  226. <if test="fEname != null and fEname != ''"> and c.f_ename like concat('%', #{fEname}, '%')</if>
  227. <if test="fTel != null and fTel != ''"> and c.f_tel like concat('%', #{fTel}, '%')</if>
  228. <if test="fFax != null and fFax != ''"> and c.f_fax = #{fFax}</if>
  229. <if test="fEmail != null and fEmail != ''"> and c.f_email = #{fEmail}</if>
  230. <if test="fManage != null and fManage != ''"> and c.f_manage = #{fManage}</if>
  231. <if test="fAddr != null and fAddr != ''"> and c.f_addr = #{fAddr}</if>
  232. <if test="fEaddr != null and fEaddr != ''"> and c.f_eaddr = #{fEaddr}</if>
  233. <if test="fScale != null and fScale != ''"> and c.f_scale = #{fScale}</if>
  234. <if test="fProvince != null and fProvince != ''"> and c.f_province = #{fProvince}</if>
  235. <if test="fCity != null and fCity != ''"> and c.f_city = #{fCity}</if>
  236. <if test="registerdAddress != null and registerdAddress != ''"> and c.registerd_address = #{registerdAddress}</if>
  237. <if test="manageScope != null and manageScope != ''"> and c.manage_scope = #{manageScope}</if>
  238. </where>
  239. </select>
  240. <select id="selectTCorpsByFTel" parameterType="String" resultMap="TCorpsResult">
  241. select f_id, f_pid, f_typeid, f_no, f_name from t_corps where f_tel = #{phonenumber}
  242. </select>
  243. <insert id="insertTCorps" parameterType="TCorps" useGeneratedKeys="true" keyProperty="fId">
  244. insert into t_corps
  245. <trim prefix="(" suffix=")" suffixOverrides=",">
  246. <if test="fPid != null and fPid != ''">f_pid,</if>
  247. <if test="fTypeid != null and fTypeid != ''">f_typeid,</if>
  248. <if test="fNo != null and fNo != ''">f_no,</if>
  249. <if test="fName != null and fName != ''">f_name,</if>
  250. <if test="fCname != null">f_cname,</if>
  251. <if test="fEname != null">f_ename,</if>
  252. <if test="fTel != null">f_tel,</if>
  253. <if test="fFax != null">f_fax,</if>
  254. <if test="fEmail != null">f_email,</if>
  255. <if test="fManage != null">f_manage,</if>
  256. <if test="fAddr != null">f_addr,</if>
  257. <if test="fEaddr != null">f_eaddr,</if>
  258. <if test="fScale != null">f_scale,</if>
  259. <if test="fProvince != null">f_province,</if>
  260. <if test="fCity != null">f_city,</if>
  261. <if test="fStltypeid != null">f_stltypeid,</if>
  262. <if test="fStldays != null">f_stldays,</if>
  263. <if test="fContractno != null">f_contractno,</if>
  264. <if test="fContractb != null">f_contractb,</if>
  265. <if test="fContracte != null">f_contracte,</if>
  266. <if test="fTax != null">f_tax,</if>
  267. <if test="fInvtel != null">f_invtel,</if>
  268. <if test="fInvaddr != null">f_invaddr,</if>
  269. <if test="fBankno != null">f_bankno,</if>
  270. <if test="fBankname != null">f_bankname,</if>
  271. <if test="fUbankno != null">f_ubankno,</if>
  272. <if test="fUbankname != null">f_ubankname,</if>
  273. <if test="fStatus != null and fStatus != ''">f_status,</if>
  274. <if test="delFlag != null">del_flag,</if>
  275. <if test="createBy != null">create_by,</if>
  276. <if test="createTime != null">create_time,</if>
  277. <if test="updateBy != null">update_by,</if>
  278. <if test="updateTime != null">update_time,</if>
  279. <if test="remark != null">remark,</if>
  280. <if test="fTypename != null">f_typename,</if>
  281. <if test="loginAccount != null">login_account,</if>
  282. <if test="creditLv != null">credit_lv,</if>
  283. <if test="paymentDays != null">payment_days,</if>
  284. <if test="carNum != null">car_num,</if>
  285. <if test="headOffice != null">head_office,</if>
  286. <if test="registerdCapital != null">registerd_capital,</if>
  287. <if test="legalPerson != null">legal_person,</if>
  288. <if test="insdustry != null">insdustry,</if>
  289. <if test="creditNum != null">credit_num,</if>
  290. <if test="taxpayerNum != null">taxpayer_num,</if>
  291. <if test="industryCommerceNum != null">industry_commerce_num,</if>
  292. <if test="organizationNum != null">organization_num,</if>
  293. <if test="registerOrganization != null">register_organization,</if>
  294. <if test="dateOfEstablishment != null">date_of_establishment,</if>
  295. <if test="companyType != null">company_type,</if>
  296. <if test="businessDeadline != null">business_deadline,</if>
  297. <if test="businessArea != null">business_area,</if>
  298. <if test="annualDate != null">annual_date,</if>
  299. <if test="registerdAddress != null">registerd_address,</if>
  300. <if test="manageScope != null">manage_scope,</if>
  301. <if test="deptId != null">dept_id,</if>
  302. <if test="uscc != null">uscc,</if>
  303. </trim>
  304. <trim prefix="values (" suffix=")" suffixOverrides=",">
  305. <if test="fPid != null and fPid != ''">#{fPid},</if>
  306. <if test="fTypeid != null and fTypeid != ''">#{fTypeid},</if>
  307. <if test="fNo != null and fNo != ''">#{fNo},</if>
  308. <if test="fName != null and fName != ''">#{fName},</if>
  309. <if test="fCname != null">#{fCname},</if>
  310. <if test="fEname != null">#{fEname},</if>
  311. <if test="fTel != null">#{fTel},</if>
  312. <if test="fFax != null">#{fFax},</if>
  313. <if test="fEmail != null">#{fEmail},</if>
  314. <if test="fManage != null">#{fManage},</if>
  315. <if test="fAddr != null">#{fAddr},</if>
  316. <if test="fEaddr != null">#{fEaddr},</if>
  317. <if test="fScale != null">#{fScale},</if>
  318. <if test="fProvince != null">#{fProvince},</if>
  319. <if test="fCity != null">#{fCity},</if>
  320. <if test="fStltypeid != null">#{fStltypeid},</if>
  321. <if test="fStldays != null">#{fStldays},</if>
  322. <if test="fContractno != null">#{fContractno},</if>
  323. <if test="fContractb != null">#{fContractb},</if>
  324. <if test="fContracte != null">#{fContracte},</if>
  325. <if test="fTax != null">#{fTax},</if>
  326. <if test="fInvtel != null">#{fInvtel},</if>
  327. <if test="fInvaddr != null">#{fInvaddr},</if>
  328. <if test="fBankno != null">#{fBankno},</if>
  329. <if test="fBankname != null">#{fBankname},</if>
  330. <if test="fUbankno != null">#{fUbankno},</if>
  331. <if test="fUbankname != null">#{fUbankname},</if>
  332. <if test="fStatus != null and fStatus != ''">#{fStatus},</if>
  333. <if test="delFlag != null">#{delFlag},</if>
  334. <if test="createBy != null">#{createBy},</if>
  335. <if test="createTime != null">#{createTime},</if>
  336. <if test="updateBy != null">#{updateBy},</if>
  337. <if test="updateTime != null">#{updateTime},</if>
  338. <if test="remark != null">#{remark},</if>
  339. <if test="fTypename != null">#{fTypename},</if>
  340. <if test="loginAccount != null">#{loginAccount},</if>
  341. <if test="creditLv != null">#{creditLv},</if>
  342. <if test="paymentDays != null">#{paymentDays},</if>
  343. <if test="carNum != null">#{carNum},</if>
  344. <if test="headOffice != null">#{headOffice},</if>
  345. <if test="registerdCapital != null">#{registerdCapital},</if>
  346. <if test="legalPerson != null">#{legalPerson},</if>
  347. <if test="insdustry != null">#{insdustry},</if>
  348. <if test="creditNum != null">#{creditNum},</if>
  349. <if test="taxpayerNum != null">#{taxpayerNum},</if>
  350. <if test="industryCommerceNum != null">#{industryCommerceNum},</if>
  351. <if test="organizationNum != null">#{organizationNum},</if>
  352. <if test="registerOrganization != null">#{registerOrganization},</if>
  353. <if test="dateOfEstablishment != null">#{dateOfEstablishment},</if>
  354. <if test="companyType != null">#{companyType},</if>
  355. <if test="businessDeadline != null">#{businessDeadline},</if>
  356. <if test="businessArea != null">#{businessArea},</if>
  357. <if test="annualDate != null">#{annualDate},</if>
  358. <if test="registerdAddress != null">#{registerdAddress},</if>
  359. <if test="manageScope != null">#{manageScope},</if>
  360. <if test="deptId != null">#{deptId},</if>
  361. <if test="uscc != null">#{uscc},</if>
  362. </trim>
  363. </insert>
  364. <update id="updateTCorps" parameterType="TCorps">
  365. update t_corps
  366. <trim prefix="SET" suffixOverrides=",">
  367. <if test="fPid != null">f_pid = #{fPid},</if>
  368. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  369. <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
  370. <if test="fName != null and fName != ''">f_name = #{fName},</if>
  371. <if test="fCname != null">f_cname = #{fCname},</if>
  372. <if test="fEname != null">f_ename = #{fEname},</if>
  373. <if test="fTel != null">f_tel = #{fTel},</if>
  374. <if test="fFax != null">f_fax = #{fFax},</if>
  375. <if test="fEmail != null">f_email = #{fEmail},</if>
  376. <if test="fManage != null">f_manage = #{fManage},</if>
  377. <if test="fAddr != null">f_addr = #{fAddr},</if>
  378. <if test="fEaddr != null">f_eaddr = #{fEaddr},</if>
  379. <if test="fScale != null">f_scale = #{fScale},</if>
  380. <if test="fProvince != null">f_province = #{fProvince},</if>
  381. <if test="fCity != null">f_city = #{fCity},</if>
  382. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  383. <if test="fStldays != null">f_stldays = #{fStldays},</if>
  384. <if test="fContractno != null">f_contractno = #{fContractno},</if>
  385. <if test="fContractb != null">f_contractb = #{fContractb},</if>
  386. <if test="fContracte != null">f_contracte = #{fContracte},</if>
  387. <if test="fTax != null">f_tax = #{fTax},</if>
  388. <if test="fInvtel != null">f_invtel = #{fInvtel},</if>
  389. <if test="fInvaddr != null">f_invaddr = #{fInvaddr},</if>
  390. <if test="fBankno != null">f_bankno = #{fBankno},</if>
  391. <if test="fBankname != null">f_bankname = #{fBankname},</if>
  392. <if test="fUbankno != null">f_ubankno = #{fUbankno},</if>
  393. <if test="fUbankname != null">f_ubankname = #{fUbankname},</if>
  394. <if test="fStatus != null and fStatus != ''">f_status = #{fStatus},</if>
  395. <if test="delFlag != null">del_flag = #{delFlag},</if>
  396. <if test="createBy != null">create_by = #{createBy},</if>
  397. <if test="createTime != null">create_time = #{createTime},</if>
  398. <if test="updateBy != null">update_by = #{updateBy},</if>
  399. <if test="updateTime != null">update_time = #{updateTime},</if>
  400. <if test="remark != null">remark = #{remark},</if>
  401. <if test="fTypename != null">f_typename = #{fTypename},</if>
  402. <if test="deptId != null">dept_id = #{deptId},</if>
  403. <if test="uscc != null">uscc = #{uscc},</if>
  404. </trim>
  405. where f_id = #{fId}
  406. </update>
  407. <delete id="deleteTCorpsById" parameterType="Long">
  408. delete from t_corps where f_id = #{fId}
  409. </delete>
  410. <delete id="deleteTCorpsByIds" parameterType="String">
  411. delete from t_corps where f_id in
  412. <foreach item="fId" collection="array" open="(" separator="," close=")">
  413. #{fId}
  414. </foreach>
  415. </delete>
  416. <select id="checkFNoUnique" parameterType="String" resultMap="TCorpsResult">
  417. select f_id,f_no from t_corps where f_no = #{fNo} limit 1
  418. </select>
  419. <select id="checkUFNnameUnique" parameterType="String" resultMap="TCorpsResult">
  420. select f_id,f_name from t_corps where f_name = #{fAame} limit 1
  421. </select>
  422. <select id="checkUFCnameUnique" parameterType="String" resultMap="TCorpsResult">
  423. select f_id,f_addr from t_corps where f_cname = #{fCname} limit 1
  424. </select>
  425. <select id="checkULoginAccountUnique" parameterType="String" resultMap="TCorpsResult">
  426. select f_id,f_addr from t_corps where login_account = #{loginAccount} limit 1
  427. </select>
  428. <select id="getClientName" parameterType="TCorps" resultType="map">
  429. SELECT
  430. tc.f_id fId,
  431. tc.f_name fName
  432. FROM
  433. t_corps tc
  434. WHERE
  435. tc.f_status = '0'
  436. <if test="fName != null and fName != ''"> and c.f_name like concat('%', #{fName}, '%')</if>
  437. </select>
  438. <select id="getClientFid" parameterType="string" resultType="long">
  439. SELECT
  440. tc.f_id
  441. FROM
  442. t_corps tc
  443. LEFT JOIN t_customer_contact ta
  444. ON tc.f_id = ta.f_pid
  445. WHERE ta.f_tel = #{tel}
  446. </select>
  447. <select id="selectTCorpsListLimit200" parameterType="TCorps" resultMap="TCorpsResult">
  448. SELECT
  449. f_id,
  450. f_name
  451. FROM
  452. t_corps
  453. WHERE
  454. JSON_CONTAINS( f_typeid -> '$[*]', #{fTypeid}, '$')
  455. AND f_status = #{fStatus}
  456. ORDER BY CONVERT(f_name USING gbk) asc
  457. limit 1, 200
  458. </select>
  459. <select id="getClientMessage" parameterType="TCorps" resultMap="TCorpsResult">
  460. SELECT
  461. tc.*
  462. FROM
  463. t_corps tc
  464. LEFT JOIN t_customer_contact ta
  465. ON tc.f_id = ta.f_pid
  466. WHERE ta.f_tel = #{fTel}
  467. </select>
  468. <select id="selectByIds" resultMap="TCorpsResult">
  469. select
  470. f_id, f_pid, f_typeid, f_no, f_name
  471. from
  472. t_corps
  473. where
  474. f_id in
  475. <foreach item="id" collection="ids" open="(" separator="," close=")">
  476. #{id}
  477. </foreach>
  478. </select>
  479. <select id="biCustomerCount" resultType="map">
  480. select count(f_id) as customerCount
  481. from t_corps
  482. where
  483. f_id in (
  484. select distinct f_corpid from t_whgenleg where f_qtyD != 0 and f_qtyblc != 0
  485. <if test="warehouseId != null">and f_warehouseid = #{warehouseId}</if>
  486. <if test="external != null">and f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})</if>
  487. <if test="customerId != null">and f_corpid = #{customerId}</if>
  488. )
  489. </select>
  490. <select id="biCustomerList" resultType="map">
  491. select f_id as customerId,
  492. f_name as customerName
  493. from t_corps
  494. where f_typename like '%客户%'
  495. <if test="external != null and external != ''">
  496. and f_id = (select f_corpid from t_customer_contact where f_tel = #{external})
  497. </if>
  498. order by convert(f_name using gbk)
  499. </select>
  500. <select id="getCorpCount" resultType="int">
  501. select count(f_id) from t_corps where f_typename like '%客户%'
  502. </select>
  503. <select id="getCorpByName" parameterType="String" resultMap="TCorpsResult">
  504. <include refid="selectTCorpsVo"/>
  505. where f_name = #{fName} limit 1
  506. </select>
  507. <select id="getSyncCorpList" parameterType="String" resultType="map">
  508. select f_id as fId,
  509. f_no as foreignId,
  510. f_name as displayName,
  511. f_name as userName,
  512. f_tel as contractNo,
  513. f_addr as address,
  514. date_format(create_time, '%Y-%m-%d %H:%i:%S') as registrationTime,
  515. f_no AS uscc
  516. from t_corps
  517. where f_status = 0
  518. and create_time &gt; #{time}
  519. </select>
  520. <select id="verification" parameterType="String" resultMap="TCorpsResult">
  521. <include refid="selectTCorpsVo"/>
  522. where f_name = #{FName}
  523. and uscc = #{identifier}
  524. limit 1
  525. </select>
  526. </mapper>