TCorpsMapper.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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="delFlag" column="del_flag" />
  37. <result property="createBy" column="create_by" />
  38. <result property="createTime" column="create_time" />
  39. <result property="updateBy" column="update_by" />
  40. <result property="updateTime" column="update_time" />
  41. <result property="remark" column="remark" />
  42. <result property="fTypename" column="f_typename" />
  43. <result property="loginAccount" column="login_account" />
  44. <result property="creditLv" column="credit_lv" />
  45. <result property="paymentDays" column="payment_days" />
  46. <result property="carNum" column="car_num" />
  47. <result property="headOffice" column="head_office" />
  48. <result property="registerdCapital" column="registerd_capital" />
  49. <result property="legalPerson" column="legal_person" />
  50. <result property="insdustry" column="insdustry" />
  51. <result property="creditNum" column="credit_num" />
  52. <result property="taxpayerNum" column="taxpayer_num" />
  53. <result property="industryCommerceNum" column="industry_commerce_num" />
  54. <result property="organizationNum" column="organization_num" />
  55. <result property="registerOrganization" column="register_organization" />
  56. <result property="dateOfEstablishment" column="date_of_establishment" />
  57. <result property="companyType" column="company_type" />
  58. <result property="businessDeadline" column="business_deadline" />
  59. <result property="businessArea" column="business_area" />
  60. <result property="annualDate" column="annual_date" />
  61. <result property="registerdAddress" column="registerd_address" />
  62. <result property="manageScope" column="manage_scope" />
  63. <result property="deptId" column="dept_id" />
  64. </resultMap>
  65. <sql id="selectTCorpsVo">
  66. 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,
  67. f_city, f_stltypeid, f_stldays, f_contractno, f_contractb, f_contracte, f_tax, f_invtel, f_invaddr, f_bankno, f_bankname, f_ubankno,
  68. f_ubankname, f_status, del_flag, create_by, create_time, update_by, update_time, remark, f_typename, login_account, credit_lv,
  69. payment_days, car_num, head_office, registerd_capital, legal_person, insdustry, credit_num, taxpayer_num, industry_commerce_num,
  70. organization_num, register_organization, date_of_establishment, company_type, business_deadline, business_area, annual_date,
  71. registerd_address, manage_scope, dept_id from t_corps
  72. </sql>
  73. <select id="selectTCorpsList" parameterType="TCorps" resultMap="TCorpsResult">
  74. <include refid="selectTCorpsVo"/>
  75. <where>
  76. <if test="fTypeid != null and fTypeid != ''"> and JSON_CONTAINS( f_typeid -> '$[*]', #{fTypeid}, '$')</if>
  77. <if test="fTypeid == null and fTypeid == ''"> and f_typeid != '[\"100\"]' and f_typeid != '[\"102\"]'</if>
  78. <if test="fPid != null and fPid != ''"> and f_pid = #{fPid}</if>
  79. <if test="fNo != null and fNo != ''"> and f_no = #{fNo}</if>
  80. <if test="fName != null and fName != ''"> and f_name like concat('%', #{fName}, '%')</if>
  81. <if test="fCname != null and fCname != ''"> and f_cname like concat('%', #{fCname}, '%')</if>
  82. <if test="fEname != null and fEname != ''"> and f_ename like concat('%', #{fEname}, '%')</if>
  83. <if test="fTel != null and fTel != ''"> and f_tel = #{fTel}</if>
  84. <if test="fFax != null and fFax != ''"> and f_fax = #{fFax}</if>
  85. <if test="fEmail != null and fEmail != ''"> and f_email = #{fEmail}</if>
  86. <if test="fManage != null and fManage != ''"> and f_manage = #{fManage}</if>
  87. <if test="fAddr != null and fAddr != ''"> and f_addr = #{fAddr}</if>
  88. <if test="fEaddr != null and fEaddr != ''"> and f_eaddr = #{fEaddr}</if>
  89. <if test="fScale != null and fScale != ''"> and f_scale = #{fScale}</if>
  90. <if test="fProvince != null and fProvince != ''"> and f_province = #{fProvince}</if>
  91. <if test="fCity != null and fCity != ''"> and f_city = #{fCity}</if>
  92. <if test="fStltypeid != null "> and f_stltypeid = #{fStltypeid}</if>
  93. <if test="fStldays != null "> and f_stldays = #{fStldays}</if>
  94. <if test="fContractno != null and fContractno != ''"> and f_contractno = #{fContractno}</if>
  95. <if test="fContractb != null "> and f_contractb = #{fContractb}</if>
  96. <if test="fContracte != null "> and f_contracte = #{fContracte}</if>
  97. <if test="fTax != null and fTax != ''"> and f_tax = #{fTax}</if>
  98. <if test="fInvtel != null and fInvtel != ''"> and f_invtel = #{fInvtel}</if>
  99. <if test="fInvaddr != null and fInvaddr != ''"> and f_invaddr = #{fInvaddr}</if>
  100. <if test="fBankno != null and fBankno != ''"> and f_bankno = #{fBankno}</if>
  101. <if test="fBankname != null and fBankname != ''"> and f_bankname like concat('%', #{fBankname}, '%')</if>
  102. <if test="fUbankno != null and fUbankno != ''"> and f_ubankno = #{fUbankno}</if>
  103. <if test="fUbankname != null and fUbankname != ''"> and f_ubankname like concat('%', #{fUbankname}, '%')</if>
  104. <if test="fStatus != null and fStatus != ''"> and f_status = #{fStatus}</if>
  105. <if test="fTypename != null and fTypename != ''"> and f_typename like concat('%', #{fTypename}, '%')</if>
  106. <if test="loginAccount != null and loginAccount != ''"> and login_account = #{loginAccount}</if>
  107. <if test="creditLv != null and creditLv != ''"> and credit_lv = #{creditLv}</if>
  108. <if test="paymentDays != null "> and payment_days = #{paymentDays}</if>
  109. <if test="carNum != null "> and car_num = #{carNum}</if>
  110. <if test="headOffice != null and headOffice != ''"> and head_office = #{headOffice}</if>
  111. <if test="registerdCapital != null and registerdCapital != ''"> and registerd_capital = #{registerdCapital}</if>
  112. <if test="legalPerson != null and legalPerson != ''"> and legal_person = #{legalPerson}</if>
  113. <if test="insdustry != null and insdustry != ''"> and insdustry = #{insdustry}</if>
  114. <if test="creditNum != null and creditNum != ''"> and credit_num = #{creditNum}</if>
  115. <if test="taxpayerNum != null and taxpayerNum != ''"> and taxpayer_num = #{taxpayerNum}</if>
  116. <if test="industryCommerceNum != null and industryCommerceNum != ''"> and industry_commerce_num = #{industryCommerceNum}</if>
  117. <if test="organizationNum != null and organizationNum != ''"> and organization_num = #{organizationNum}</if>
  118. <if test="registerOrganization != null and registerOrganization != ''"> and register_organization = #{registerOrganization}</if>
  119. <if test="dateOfEstablishment != null "> and date_of_establishment = #{dateOfEstablishment}</if>
  120. <if test="companyType != null and companyType != ''"> and company_type = #{companyType}</if>
  121. <if test="businessDeadline != null "> and business_deadline = #{businessDeadline}</if>
  122. <if test="businessArea != null and businessArea != ''"> and business_area = #{businessArea}</if>
  123. <if test="annualDate != null "> and annual_date = #{annualDate}</if>
  124. <if test="registerdAddress != null and registerdAddress != ''"> and registerd_address = #{registerdAddress}</if>
  125. <if test="manageScope != null and manageScope != ''"> and manage_scope = #{manageScope}</if>
  126. </where>
  127. ORDER BY CONVERT(f_name USING gbk) asc
  128. </select>
  129. <select id="selectTCorpsById" parameterType="Long" resultMap="TCorpsResult">
  130. <include refid="selectTCorpsVo"/>
  131. where f_id = #{fId}
  132. </select>
  133. <select id="selectCorpList" parameterType="long" resultMap="TCorpsResult">
  134. SELECT
  135. c.f_id,
  136. c.f_pid,
  137. c.f_typeid,
  138. c.f_no,
  139. c.f_name
  140. FROM
  141. t_corps c
  142. LEFT JOIN F_TMSORDERBILLSCARS car ON car.driver_tel = c.f_tel OR car.corp_id = c.f_id
  143. WHERE
  144. c.f_typeid != '[\"102\"]'
  145. OR car.id = #{fId}
  146. </select>
  147. <select id="selectCustomerDriverList" parameterType="TCorps" resultMap="TCorpsResult">
  148. SELECT DISTINCT
  149. c.f_id,
  150. c.f_pid,
  151. c.f_typeid,
  152. c.f_no,
  153. c.f_name
  154. FROM
  155. t_corps c
  156. LEFT JOIN F_TMSORDERBILLSCARS car ON car.driver_tel = c.f_tel
  157. <where>
  158. c.f_status = '0'
  159. <if test="fName != null and fName != ''"> and c.f_name like concat('%', #{fName}, '%')</if>
  160. </where>
  161. </select>
  162. <select id="selectFleetDriverMsgListMap" parameterType="TCorps" resultType="Map">
  163. SELECT
  164. c.f_id AS id,
  165. t.f_name AS companyName,
  166. c.f_name AS name,
  167. c.f_fax AS fFax,
  168. c.f_contractb AS fContractb,
  169. c.f_eaddr AS fEaddr,
  170. c.f_contracte AS fContracte,
  171. c.f_scale AS fScale,
  172. c.f_tel AS fTel,
  173. c.f_addr AS fAddr,
  174. c.registerd_address AS registerdAddress,
  175. c.manage_scope AS manageScope,
  176. c.create_time AS creatTime,
  177. c.update_time AS updateTime,
  178. c.f_status AS fStatus,
  179. c.del_flag AS delFlag,
  180. c.create_by AS createBy,
  181. c.update_by AS updateBy,
  182. c.update_time AS updateTime,
  183. c.remark AS remark
  184. FROM
  185. t_corps c
  186. LEFT JOIN t_corps t ON t.f_id = c.f_pid
  187. <where>
  188. <if test="fTypeid != null and fTypeid != ''"> and c.f_typeid = #{fTypeid}</if>
  189. <if test="fPid != null and fPid != ''"> and c.f_pid = #{fPid}</if>
  190. <if test="fNo != null and fNo != ''"> and c.f_no = #{fNo}</if>
  191. <if test="fName != null and fName != ''"> and c.f_name like concat('%', #{fName}, '%')</if>
  192. <if test="fCname != null and fCname != ''"> and c.f_cname like concat('%', #{fCname}, '%')</if>
  193. <if test="fEname != null and fEname != ''"> and c.f_ename like concat('%', #{fEname}, '%')</if>
  194. <if test="fTel != null and fTel != ''"> and c.f_tel like concat('%', #{fTel}, '%')</if>
  195. <if test="fFax != null and fFax != ''"> and c.f_fax = #{fFax}</if>
  196. <if test="fEmail != null and fEmail != ''"> and c.f_email = #{fEmail}</if>
  197. <if test="fManage != null and fManage != ''"> and c.f_manage = #{fManage}</if>
  198. <if test="fAddr != null and fAddr != ''"> and c.f_addr = #{fAddr}</if>
  199. <if test="fEaddr != null and fEaddr != ''"> and c.f_eaddr = #{fEaddr}</if>
  200. <if test="fScale != null and fScale != ''"> and c.f_scale = #{fScale}</if>
  201. <if test="fProvince != null and fProvince != ''"> and c.f_province = #{fProvince}</if>
  202. <if test="fCity != null and fCity != ''"> and c.f_city = #{fCity}</if>
  203. <if test="registerdAddress != null and registerdAddress != ''"> and c.registerd_address = #{registerdAddress}</if>
  204. <if test="manageScope != null and manageScope != ''"> and c.manage_scope = #{manageScope}</if>
  205. </where>
  206. </select>
  207. <select id="selectTCorpsByFTel" parameterType="String" resultMap="TCorpsResult">
  208. select f_id, f_pid, f_typeid, f_no, f_name from t_corps where f_tel = #{phonenumber}
  209. </select>
  210. <insert id="insertTCorps" parameterType="TCorps" useGeneratedKeys="true" keyProperty="fId">
  211. insert into t_corps
  212. <trim prefix="(" suffix=")" suffixOverrides=",">
  213. <if test="fPid != null and fPid != ''">f_pid,</if>
  214. <if test="fTypeid != null and fTypeid != ''">f_typeid,</if>
  215. <if test="fNo != null and fNo != ''">f_no,</if>
  216. <if test="fName != null and fName != ''">f_name,</if>
  217. <if test="fCname != null">f_cname,</if>
  218. <if test="fEname != null">f_ename,</if>
  219. <if test="fTel != null">f_tel,</if>
  220. <if test="fFax != null">f_fax,</if>
  221. <if test="fEmail != null">f_email,</if>
  222. <if test="fManage != null">f_manage,</if>
  223. <if test="fAddr != null">f_addr,</if>
  224. <if test="fEaddr != null">f_eaddr,</if>
  225. <if test="fScale != null">f_scale,</if>
  226. <if test="fProvince != null">f_province,</if>
  227. <if test="fCity != null">f_city,</if>
  228. <if test="fStltypeid != null">f_stltypeid,</if>
  229. <if test="fStldays != null">f_stldays,</if>
  230. <if test="fContractno != null">f_contractno,</if>
  231. <if test="fContractb != null">f_contractb,</if>
  232. <if test="fContracte != null">f_contracte,</if>
  233. <if test="fTax != null">f_tax,</if>
  234. <if test="fInvtel != null">f_invtel,</if>
  235. <if test="fInvaddr != null">f_invaddr,</if>
  236. <if test="fBankno != null">f_bankno,</if>
  237. <if test="fBankname != null">f_bankname,</if>
  238. <if test="fUbankno != null">f_ubankno,</if>
  239. <if test="fUbankname != null">f_ubankname,</if>
  240. <if test="fStatus != null and fStatus != ''">f_status,</if>
  241. <if test="delFlag != null">del_flag,</if>
  242. <if test="createBy != null">create_by,</if>
  243. <if test="createTime != null">create_time,</if>
  244. <if test="updateBy != null">update_by,</if>
  245. <if test="updateTime != null">update_time,</if>
  246. <if test="remark != null">remark,</if>
  247. <if test="fTypename != null">f_typename,</if>
  248. <if test="loginAccount != null">login_account,</if>
  249. <if test="creditLv != null">credit_lv,</if>
  250. <if test="paymentDays != null">payment_days,</if>
  251. <if test="carNum != null">car_num,</if>
  252. <if test="headOffice != null">head_office,</if>
  253. <if test="registerdCapital != null">registerd_capital,</if>
  254. <if test="legalPerson != null">legal_person,</if>
  255. <if test="insdustry != null">insdustry,</if>
  256. <if test="creditNum != null">credit_num,</if>
  257. <if test="taxpayerNum != null">taxpayer_num,</if>
  258. <if test="industryCommerceNum != null">industry_commerce_num,</if>
  259. <if test="organizationNum != null">organization_num,</if>
  260. <if test="registerOrganization != null">register_organization,</if>
  261. <if test="dateOfEstablishment != null">date_of_establishment,</if>
  262. <if test="companyType != null">company_type,</if>
  263. <if test="businessDeadline != null">business_deadline,</if>
  264. <if test="businessArea != null">business_area,</if>
  265. <if test="annualDate != null">annual_date,</if>
  266. <if test="registerdAddress != null">registerd_address,</if>
  267. <if test="manageScope != null">manage_scope,</if>
  268. <if test="deptId != null">dept_id,</if>
  269. </trim>
  270. <trim prefix="values (" suffix=")" suffixOverrides=",">
  271. <if test="fPid != null and fPid != ''">#{fPid},</if>
  272. <if test="fTypeid != null and fTypeid != ''">#{fTypeid},</if>
  273. <if test="fNo != null and fNo != ''">#{fNo},</if>
  274. <if test="fName != null and fName != ''">#{fName},</if>
  275. <if test="fCname != null">#{fCname},</if>
  276. <if test="fEname != null">#{fEname},</if>
  277. <if test="fTel != null">#{fTel},</if>
  278. <if test="fFax != null">#{fFax},</if>
  279. <if test="fEmail != null">#{fEmail},</if>
  280. <if test="fManage != null">#{fManage},</if>
  281. <if test="fAddr != null">#{fAddr},</if>
  282. <if test="fEaddr != null">#{fEaddr},</if>
  283. <if test="fScale != null">#{fScale},</if>
  284. <if test="fProvince != null">#{fProvince},</if>
  285. <if test="fCity != null">#{fCity},</if>
  286. <if test="fStltypeid != null">#{fStltypeid},</if>
  287. <if test="fStldays != null">#{fStldays},</if>
  288. <if test="fContractno != null">#{fContractno},</if>
  289. <if test="fContractb != null">#{fContractb},</if>
  290. <if test="fContracte != null">#{fContracte},</if>
  291. <if test="fTax != null">#{fTax},</if>
  292. <if test="fInvtel != null">#{fInvtel},</if>
  293. <if test="fInvaddr != null">#{fInvaddr},</if>
  294. <if test="fBankno != null">#{fBankno},</if>
  295. <if test="fBankname != null">#{fBankname},</if>
  296. <if test="fUbankno != null">#{fUbankno},</if>
  297. <if test="fUbankname != null">#{fUbankname},</if>
  298. <if test="fStatus != null and fStatus != ''">#{fStatus},</if>
  299. <if test="delFlag != null">#{delFlag},</if>
  300. <if test="createBy != null">#{createBy},</if>
  301. <if test="createTime != null">#{createTime},</if>
  302. <if test="updateBy != null">#{updateBy},</if>
  303. <if test="updateTime != null">#{updateTime},</if>
  304. <if test="remark != null">#{remark},</if>
  305. <if test="fTypename != null">#{fTypename},</if>
  306. <if test="loginAccount != null">#{loginAccount},</if>
  307. <if test="creditLv != null">#{creditLv},</if>
  308. <if test="paymentDays != null">#{paymentDays},</if>
  309. <if test="carNum != null">#{carNum},</if>
  310. <if test="headOffice != null">#{headOffice},</if>
  311. <if test="registerdCapital != null">#{registerdCapital},</if>
  312. <if test="legalPerson != null">#{legalPerson},</if>
  313. <if test="insdustry != null">#{insdustry},</if>
  314. <if test="creditNum != null">#{creditNum},</if>
  315. <if test="taxpayerNum != null">#{taxpayerNum},</if>
  316. <if test="industryCommerceNum != null">#{industryCommerceNum},</if>
  317. <if test="organizationNum != null">#{organizationNum},</if>
  318. <if test="registerOrganization != null">#{registerOrganization},</if>
  319. <if test="dateOfEstablishment != null">#{dateOfEstablishment},</if>
  320. <if test="companyType != null">#{companyType},</if>
  321. <if test="businessDeadline != null">#{businessDeadline},</if>
  322. <if test="businessArea != null">#{businessArea},</if>
  323. <if test="annualDate != null">#{annualDate},</if>
  324. <if test="registerdAddress != null">#{registerdAddress},</if>
  325. <if test="manageScope != null">#{manageScope},</if>
  326. <if test="deptId != null">#{deptId},</if>
  327. </trim>
  328. </insert>
  329. <update id="updateTCorps" parameterType="TCorps">
  330. update t_corps
  331. <trim prefix="SET" suffixOverrides=",">
  332. <if test="fPid != null">f_pid = #{fPid},</if>
  333. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  334. <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
  335. <if test="fName != null and fName != ''">f_name = #{fName},</if>
  336. <if test="fCname != null">f_cname = #{fCname},</if>
  337. <if test="fEname != null">f_ename = #{fEname},</if>
  338. <if test="fTel != null">f_tel = #{fTel},</if>
  339. <if test="fFax != null">f_fax = #{fFax},</if>
  340. <if test="fEmail != null">f_email = #{fEmail},</if>
  341. <if test="fManage != null">f_manage = #{fManage},</if>
  342. <if test="fAddr != null">f_addr = #{fAddr},</if>
  343. <if test="fEaddr != null">f_eaddr = #{fEaddr},</if>
  344. <if test="fScale != null">f_scale = #{fScale},</if>
  345. <if test="fProvince != null">f_province = #{fProvince},</if>
  346. <if test="fCity != null">f_city = #{fCity},</if>
  347. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  348. <if test="fStldays != null">f_stldays = #{fStldays},</if>
  349. <if test="fContractno != null">f_contractno = #{fContractno},</if>
  350. <if test="fContractb != null">f_contractb = #{fContractb},</if>
  351. <if test="fContracte != null">f_contracte = #{fContracte},</if>
  352. <if test="fTax != null">f_tax = #{fTax},</if>
  353. <if test="fInvtel != null">f_invtel = #{fInvtel},</if>
  354. <if test="fInvaddr != null">f_invaddr = #{fInvaddr},</if>
  355. <if test="fBankno != null">f_bankno = #{fBankno},</if>
  356. <if test="fBankname != null">f_bankname = #{fBankname},</if>
  357. <if test="fUbankno != null">f_ubankno = #{fUbankno},</if>
  358. <if test="fUbankname != null">f_ubankname = #{fUbankname},</if>
  359. <if test="fStatus != null and fStatus != ''">f_status = #{fStatus},</if>
  360. <if test="delFlag != null">del_flag = #{delFlag},</if>
  361. <if test="createBy != null">create_by = #{createBy},</if>
  362. <if test="createTime != null">create_time = #{createTime},</if>
  363. <if test="updateBy != null">update_by = #{updateBy},</if>
  364. <if test="updateTime != null">update_time = #{updateTime},</if>
  365. <if test="remark != null">remark = #{remark},</if>
  366. <if test="fTypename != null">f_typename = #{fTypename},</if>
  367. <if test="deptId != null">dept_id = #{deptId},</if>
  368. </trim>
  369. where f_id = #{fId}
  370. </update>
  371. <delete id="deleteTCorpsById" parameterType="Long">
  372. delete from t_corps where f_id = #{fId}
  373. </delete>
  374. <delete id="deleteTCorpsByIds" parameterType="String">
  375. delete from t_corps where f_id in
  376. <foreach item="fId" collection="array" open="(" separator="," close=")">
  377. #{fId}
  378. </foreach>
  379. </delete>
  380. <select id="checkFNoUnique" parameterType="String" resultMap="TCorpsResult">
  381. select f_id,f_no from t_corps where f_no = #{fNo} limit 1
  382. </select>
  383. <select id="checkUFNnameUnique" parameterType="String" resultMap="TCorpsResult">
  384. select f_id,f_name from t_corps where f_name = #{fAame} limit 1
  385. </select>
  386. <select id="checkUFCnameUnique" parameterType="String" resultMap="TCorpsResult">
  387. select f_id,f_addr from t_corps where f_cname = #{fCname} limit 1
  388. </select>
  389. <select id="checkULoginAccountUnique" parameterType="String" resultMap="TCorpsResult">
  390. select f_id,f_addr from t_corps where login_account = #{loginAccount} limit 1
  391. </select>
  392. <select id="getClientName" parameterType="TCorps" resultType="map">
  393. SELECT
  394. tc.f_id fId,
  395. tc.f_name fName
  396. FROM
  397. t_corps tc
  398. WHERE
  399. tc.f_status = '0'
  400. <if test="fName != null and fName != ''"> and c.f_name like concat('%', #{fName}, '%')</if>
  401. </select>
  402. <select id="getClientFid" parameterType="string" resultType="long">
  403. SELECT
  404. tc.f_id
  405. FROM
  406. t_corps tc
  407. LEFT JOIN t_customer_contact ta
  408. ON tc.f_id = ta.f_pid
  409. WHERE ta.f_tel = #{tel}
  410. </select>
  411. <select id="selectTCorpsListLimit200" parameterType="TCorps" resultMap="TCorpsResult">
  412. SELECT
  413. f_id,
  414. f_name
  415. FROM
  416. t_corps
  417. WHERE
  418. JSON_CONTAINS( f_typeid -> '$[*]', #{fTypeid}, '$')
  419. AND f_status = #{fStatus}
  420. ORDER BY CONVERT(f_name USING gbk) asc
  421. limit 1, 200
  422. </select>
  423. <select id="getClientMessage" parameterType="TCorps" resultMap="TCorpsResult">
  424. SELECT
  425. tc.*
  426. FROM
  427. t_corps tc
  428. LEFT JOIN t_customer_contact ta
  429. ON tc.f_id = ta.f_pid
  430. WHERE ta.f_tel = #{fTel}
  431. </select>
  432. <select id="selectByIds" resultMap="TCorpsResult">
  433. select
  434. f_id, f_pid, f_typeid, f_no, f_name
  435. from
  436. t_corps
  437. where
  438. f_id in
  439. <foreach item="id" collection="ids" open="(" separator="," close=")">
  440. #{id}
  441. </foreach>
  442. </select>
  443. <select id="biCustomerCount" parameterType="long" resultType="map">
  444. select count(f_id) as customerCount
  445. from t_corps
  446. where f_id in (
  447. select distinct f_corpid from t_whgenleg where f_qtyD != 0 and f_qtyblc != 0
  448. <if test="warehouseId != null"> and f_warehouseid = #{warehouseId}</if>
  449. );
  450. </select>
  451. </mapper>