qhjAgreement.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. /**
  2. * @Author: zou.yingbin
  3. * @Create : 2021/6/30 9:31
  4. * @Modify : 2021/6/30 9:31
  5. */
  6. package models
  7. import (
  8. "mtp2_if/db"
  9. "mtp2_if/utils"
  10. )
  11. // QhjAgreementConfig 协议配置
  12. type QhjAgreementConfig struct {
  13. AGREEMENTID int64 `json:"agreementid" xorm:"AGREEMENTID" form:"agreementid"` // 协议ID(SEQ_QHJ_AGREEMENTCONFIG)
  14. AGREEMENTVERSION int32 `json:"agreementversion" xorm:"AGREEMENTVERSION" form:"agreementversion"` // 协议版本号(从1开始每次修改加1)
  15. AGREEMENTNO string `json:"agreementno" xorm:"AGREEMENTNO" form:"agreementno"` // 协议编号
  16. AGREEMENTNAME string `json:"agreementname" xorm:"AGREEMENTNAME" form:"agreementname"` // 协议名称
  17. AGREEMENTTYPE int32 `json:"agreementtype" xorm:"AGREEMENTTYPE" form:"agreementtype"` // 协议类型 - 1:注册 2:登录 3:交易
  18. AGREEMENTFREQUENCY int32 `json:"agreementfrequency" xorm:"AGREEMENTFREQUENCY" form:"agreementfrequency"` // 协议频率 - 1:首次 2:每次 [登录为2, 其它为1]
  19. AGREEMENTCONTENT string `json:"agreementcontent" xorm:"AGREEMENTCONTENT" form:"agreementcontent"` // 协议内容
  20. ISVALID int32 `json:"isvalid" xorm:"ISVALID" form:"isvalid"` // 是否有效 - 0:无效 1:有效
  21. CREATORSRC int32 `json:"creatorsrc" xorm:"CREATORSRC" form:"creatorsrc"` // 创建来源 - 1:管理端 2:终端
  22. CREATORID int64 `json:"creatorid" xorm:"CREATORID" form:"creatorid"` // 创建人
  23. CREATETIME string `json:"createtime" xorm:"CREATETIME" form:"createtime"` // 创建时间
  24. REVISERSRC int32 `json:"revisersrc" xorm:"REVISERSRC" form:"revisersrc"` // 修改来源 - 1:管理端 2:终端
  25. REVISERID int64 `json:"reviserid" xorm:"REVISERID" form:"reviserid"` // 修改人
  26. UPDATETIME string `json:"updatetime" xorm:"UPDATETIME" form:"updatetime"` // 更新时间
  27. }
  28. func (r *QhjAgreementConfig) calc() {
  29. }
  30. func (r *QhjAgreementConfig) buildSql() string {
  31. var sqlId utils.SQLVal = "SELECT t.AGREEMENTID," +
  32. " t.AGREEMENTVERSION," +
  33. " t.AGREEMENTNO," +
  34. " t.AGREEMENTNAME," +
  35. " t.AGREEMENTTYPE," +
  36. " t.AGREEMENTFREQUENCY," +
  37. " to_char(t.AGREEMENTCONTENT) AGREEMENTCONTENT," +
  38. " t.ISVALID," +
  39. " t.CREATORSRC," +
  40. " t.CREATORID," +
  41. " to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
  42. " t.REVISERSRC," +
  43. " t.REVISERID," +
  44. " to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME" +
  45. " FROM QHJ_AgreementConfig t" +
  46. " WHERE 1 = 1"
  47. sqlId.AndEx("t.agreementid", r.AGREEMENTID, r.AGREEMENTID > 0)
  48. sqlId.AndEx("t.agreementversion", r.AGREEMENTVERSION, r.AGREEMENTVERSION > 0)
  49. sqlId.AndEx("t.agreementtype", r.AGREEMENTTYPE, r.AGREEMENTTYPE > 0)
  50. sqlId.AndEx("t.agreementfrequency", r.AGREEMENTFREQUENCY, r.AGREEMENTFREQUENCY > 0)
  51. sqlId.AndEx("t.isvalid", r.ISVALID, r.ISVALID > 0)
  52. sqlId.AndLike("t.agreementno", r.AGREEMENTNO)
  53. sqlId.AndLike("t.agreementname", r.AGREEMENTNAME)
  54. return sqlId.String()
  55. }
  56. // GetDataEx 获取协议配置
  57. func (r *QhjAgreementConfig) GetDataEx() (interface{}, error) {
  58. sData := make([]QhjAgreementConfig, 0)
  59. err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
  60. for i := range sData {
  61. sData[i].calc()
  62. }
  63. return sData, err
  64. }
  65. // QhjAgreementChangeLog 协议配置变更流水
  66. type QhjAgreementChangeLog struct {
  67. LOGID int64 `json:"logid" xorm:"LOGID" form:"logid"` // 流水ID(SEQ_QHJ_AGREEMENTCHANGELOG)
  68. AGREEMENTID int64 `json:"agreementid" xorm:"AGREEMENTID" form:"agreementid"` // 协议ID
  69. AGREEMENTVERSION int32 `json:"agreementversion" xorm:"AGREEMENTVERSION" form:"agreementversion"` // 协议版本号
  70. AGREEMENTNO string `json:"agreementno" xorm:"AGREEMENTNO" form:"agreementno"` // 协议编号
  71. AGREEMENTNAME string `json:"agreementname" xorm:"AGREEMENTNAME" form:"agreementname"` // 协议名称
  72. AGREEMENTTYPE int32 `json:"agreementtype" xorm:"AGREEMENTTYPE" form:"agreementtype"` // 协议类型 - 1:注册 2:登录 3:交易
  73. AGREEMENTFREQUENCY int32 `json:"agreementfrequency" xorm:"AGREEMENTFREQUENCY" form:"agreementfrequency"` // 协议频率 - 1:首次 2:每次 [登录为2, 其它为1]
  74. AGREEMENTCONTENT string `json:"agreementcontent" xorm:"AGREEMENTCONTENT" form:"agreementcontent"` // 协议内容
  75. REVISERSRC int32 `json:"revisersrc" xorm:"REVISERSRC" form:"revisersrc"` // 修改来源 - 1:管理端 2:终端
  76. REVISERID int64 `json:"reviserid" xorm:"REVISERID" form:"reviserid"` // 修改人
  77. UPDATETIME string `json:"updatetime" xorm:"UPDATETIME" form:"updatetime"` // 更新时间
  78. }
  79. func (r *QhjAgreementChangeLog) calc() {
  80. }
  81. func (r *QhjAgreementChangeLog) buildSql() string {
  82. var sqlId utils.SQLVal = "SELECT t.LOGID," +
  83. " t.AGREEMENTID," +
  84. " t.AGREEMENTVERSION," +
  85. " t.AGREEMENTNO," +
  86. " t.AGREEMENTNAME," +
  87. " t.AGREEMENTTYPE," +
  88. " t.AGREEMENTFREQUENCY," +
  89. " to_char(t.AGREEMENTCONTENT) AGREEMENTCONTENT," +
  90. " t.REVISERSRC," +
  91. " t.REVISERID," +
  92. " to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME" +
  93. " FROM QHJ_AGREEMENTCHANGELOG t" +
  94. " WHERE 1 = 1"
  95. sqlId.AndEx("t.logid", r.LOGID, r.LOGID > 0)
  96. sqlId.AndEx("t.agreementid", r.AGREEMENTID, r.AGREEMENTID > 0)
  97. sqlId.AndEx("t.agreementversion", r.AGREEMENTVERSION, r.AGREEMENTVERSION > 0)
  98. sqlId.AndEx("t.agreementtype", r.AGREEMENTTYPE, r.AGREEMENTTYPE > 0)
  99. sqlId.AndLike("t.agreementno", r.AGREEMENTNO)
  100. sqlId.AndLike("t.agreementname", r.AGREEMENTNAME)
  101. return sqlId.String()
  102. }
  103. // GetDataEx 获取协议配置变更流水
  104. func (r *QhjAgreementChangeLog) GetDataEx() (interface{}, error) {
  105. sData := make([]QhjAgreementChangeLog, 0)
  106. err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
  107. for i := range sData {
  108. sData[i].calc()
  109. }
  110. return sData, err
  111. }
  112. // QhjNodeAgreementConfig 协议节点配置
  113. type QhjNodeAgreementConfig struct {
  114. AGREEMENTTYPE int32 `json:"agreementtype" xorm:"AGREEMENTTYPE" form:"agreementtype"` // 协议类型 - 1:注册 2:登录 3:交易
  115. AGREEMENTVERSION int32 `json:"agreementversion" xorm:"AGREEMENTVERSION" form:"agreementversion"` // 协议版本号
  116. NODETYPE int32 `json:"nodetype" xorm:"NODETYPE" form:"nodetype"` // 环节类型 - 1:注册 2:登录 3:购买 4:融资购买 5:定投 6:卖出
  117. CONFIGID int64 `json:"configid" xorm:"CONFIGID" form:"configid"` // 配置(SEQ_QHJ_NODEAGREEMENTCONFIG)
  118. AGREEMENTID int64 `json:"agreementid" xorm:"AGREEMENTID" form:"agreementid"` // 协议ID
  119. CREATETIME string `json:"createtime" xorm:"CREATETIME" form:"createtime"` // 创建时间
  120. GOODSID int32 `json:"goodsid" xorm:"GOODSID" form:"goodsid"` // 商品ID [默认为0, NodeType>=3 的为商品值]
  121. AGREEMENTNO string `json:"agreementno" xorm:"AGREEMENTNO" form:"agreementno"` // 协议编号
  122. AGREEMENTNAME string `json:"agreementname" xorm:"AGREEMENTNAME" form:"agreementname"` // 协议名称
  123. AGREEMENTCONTENT string `json:"agreementcontent" xorm:"AGREEMENTCONTENT" form:"agreementcontent"` // 协议内容
  124. }
  125. func (r *QhjNodeAgreementConfig) calc() {
  126. }
  127. func (r *QhjNodeAgreementConfig) buildSql() string {
  128. var sqlId utils.SQLVal = "SELECT t.CONFIGID," +
  129. " t.NODETYPE," +
  130. " t.GOODSID," +
  131. " t.AGREEMENTID," +
  132. " t.AGREEMENTTYPE," +
  133. " t.AGREEMENTVERSION," +
  134. " to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
  135. " c.agreementno," +
  136. " c.agreementname," +
  137. " to_char(c.agreementcontent) agreementcontent" +
  138. " FROM QHJ_NODEAGREEMENTCONFIG t" +
  139. " LEFT JOIN QHJ_AGREEMENTCONFIG c on t.agreementid=c.agreementid" +
  140. " WHERE 1 = 1"
  141. sqlId.AndEx("t.configid", r.CONFIGID, r.CONFIGID > 0)
  142. sqlId.AndEx("t.nodetype", r.NODETYPE, r.NODETYPE > 0)
  143. sqlId.AndEx("t.goodsid", r.GOODSID, r.GOODSID > 0)
  144. sqlId.AndEx("t.agreementid", r.AGREEMENTID, r.AGREEMENTID > 0)
  145. sqlId.AndEx("t.agreementtype", r.AGREEMENTTYPE, r.AGREEMENTTYPE > 0)
  146. sqlId.AndEx("t.agreementversion", r.AGREEMENTVERSION, r.AGREEMENTVERSION > 0)
  147. sqlId.AndLike("c.agreementno", r.AGREEMENTNO)
  148. sqlId.AndLike("c.agreementname", r.AGREEMENTNAME)
  149. return sqlId.String()
  150. }
  151. // GetDataEx 获取协议节点配置
  152. func (r *QhjNodeAgreementConfig) GetDataEx() (interface{}, error) {
  153. sData := make([]QhjNodeAgreementConfig, 0)
  154. err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
  155. for i := range sData {
  156. sData[i].calc()
  157. }
  158. return sData, err
  159. }
  160. // QhjCustomerSignStatus 协议签约状态
  161. type QhjCustomerSignStatus struct {
  162. NODETYPE int32 `json:"nodetype" xorm:"NODETYPE" form:"nodetype"` // 环节类型 - 1:注册 2:登录 3:购买 4:融资购买 5:定投 6:卖出 99:首次交易
  163. USERID int64 `json:"userid" xorm:"USERID" form:"userid"` // 客户ID
  164. CREATETIME string `json:"createtime" xorm:"CREATETIME" form:"createtime"` // 创建时间
  165. GOODSID int32 `json:"goodsid" xorm:"GOODSID" form:"goodsid"` // 商品ID [默认为0, NodeType>=3 的为商品值]
  166. SIGNTIMESTAMP string `json:"signtimestamp" xorm:"SIGNTIMESTAMP" form:"signtimestamp"` // 签约状态时间戳
  167. TRADEDATE string `json:"tradedate" xorm:"TRADEDATE" form:"tradedate"` // 创建交易日(yyyyMMdd)
  168. UPDATETIME string `json:"updatetime" xorm:"UPDATETIME" form:"updatetime"` // 更新时间
  169. USERNAME string `json:"username" xorm:"USERNAME" form:"USERNAME"` // 客户名称
  170. GOODSNAME string `json:"goodsname" xorm:"GOODSNAME" form:"GOODSNAME"` // 商品名称
  171. GOODSCODE string `json:"goodscode" xorm:"GOODSCODE" form:"GOODSCODE"` // 商品代码
  172. }
  173. func (r *QhjCustomerSignStatus) calc() {
  174. }
  175. func (r *QhjCustomerSignStatus) buildSql() string {
  176. var sqlId utils.SQLVal = "SELECT t.USERID," +
  177. " t.NODETYPE," +
  178. " t.GOODSID," +
  179. " to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
  180. " t.TRADEDATE," +
  181. " to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
  182. " t.SIGNTIMESTAMP," +
  183. " u.accountname username," +
  184. " g.goodscode," +
  185. " g.goodsname" +
  186. " FROM QHJ_CUSTOMERSIGNSTATUS t" +
  187. " LEFT JOIN USERACCOUNT u on t.userid=u.userid" +
  188. " LEFT JOIN GOODS g on t.goodsid=g.goodsid" +
  189. " WHERE 1 = 1"
  190. sqlId.AndEx("t.userid", r.USERID, r.USERID > 0)
  191. sqlId.AndEx("t.nodetype", r.NODETYPE, r.NODETYPE > 0)
  192. sqlId.AndEx("t.goodsid", r.GOODSID, r.GOODSID > 0)
  193. sqlId.AndEx("t.tradedate", r.TRADEDATE, r.TRADEDATE != "")
  194. sqlId.AndLike("u.accountname", r.USERNAME)
  195. return sqlId.String()
  196. }
  197. // GetDataEx 获取协议签约状态
  198. func (r *QhjCustomerSignStatus) GetDataEx() (interface{}, error) {
  199. sData := make([]QhjCustomerSignStatus, 0)
  200. err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
  201. for i := range sData {
  202. sData[i].calc()
  203. }
  204. return sData, err
  205. }
  206. // QhjCustomerSignLog 客户协议签约流水
  207. type QhjCustomerSignLog struct {
  208. AGREEMENTVERSION int32 `json:"agreementversion" xorm:"AGREEMENTVERSION" form:"agreementversion"` // 协议版本号
  209. NODETYPE int32 `json:"nodetype" xorm:"NODETYPE" form:"nodetype"` // 环节类型 - 1:注册 2:登录 3:购买 4:融资购买 5:定投 6:卖出
  210. LOGID int64 `json:"logid" xorm:"LOGID" form:"logid"` // 流水ID(SEQ_QHJ_CUSTOMERSIGNLOG)
  211. USERID int64 `json:"userid" xorm:"USERID" form:"userid"` // 客户ID
  212. AGREEMENTID int64 `json:"agreementid" xorm:"AGREEMENTID" form:"agreementid"` // 协议ID
  213. CREATETIME string `json:"createtime" xorm:"CREATETIME" form:"createtime"` // 创建时间
  214. GOODSID int32 `json:"goodsid" xorm:"GOODSID" form:"goodsid"` // 商品ID [默认为0, NodeType>=3 的为商品值]
  215. SIGNADRESSURL string `json:"signadressurl" xorm:"SIGNADRESSURL" form:"signadressurl"` // 签约文件地址
  216. SIGNTIMESTAMP string `json:"signtimestamp" xorm:"SIGNTIMESTAMP" form:"signtimestamp"` // 签约状态时间戳
  217. USERNAME string `json:"username" xorm:"USERNAME" form:"USERNAME"` // 客户名称
  218. GOODSNAME string `json:"goodsname" xorm:"GOODSNAME" form:"GOODSNAME"` // 商品名称
  219. GOODSCODE string `json:"goodscode" xorm:"GOODSCODE" form:"GOODSCODE"` // 商品代码
  220. AGREEMENTNO string `json:"agreementno" xorm:"AGREEMENTNO" form:"agreementno"` // 协议编号
  221. AGREEMENTNAME string `json:"agreementname" xorm:"AGREEMENTNAME" form:"agreementname"` // 协议名称
  222. AGREEMENTTYPE int32 `json:"agreementtype" xorm:"AGREEMENTTYPE" form:"agreementtype"` // 协议类型 - 1:注册 2:登录 3:交易
  223. AGREEMENTCONTENT string `json:"agreementcontent" xorm:"AGREEMENTCONTENT" form:"agreementcontent"` // 协议内容
  224. }
  225. func (r *QhjCustomerSignLog) calc() {
  226. }
  227. func (r *QhjCustomerSignLog) buildSql() string {
  228. var sqlId utils.SQLVal = "SELECT t.LOGID," +
  229. " t.USERID," +
  230. " t.NODETYPE," +
  231. " t.GOODSID," +
  232. " t.AGREEMENTID," +
  233. " t.AGREEMENTVERSION," +
  234. " to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
  235. " t.SIGNTIMESTAMP," +
  236. " t.SIGNADRESSURL," +
  237. " c.agreementno," +
  238. " c.agreementname," +
  239. " c.agreementtype," +
  240. " to_char(c.agreementcontent) agreementcontent," +
  241. " u.accountname username," +
  242. " g.goodscode," +
  243. " g.goodsname" +
  244. " FROM QHJ_CUSTOMERSIGNLOG t" +
  245. " LEFT JOIN QHJ_AGREEMENTCONFIG c on t.agreementid=c.agreementid" +
  246. " LEFT JOIN USERACCOUNT u on t.userid=u.userid" +
  247. " LEFT JOIN GOODS g on t.goodsid=g.goodsid" +
  248. " WHERE 1 = 1"
  249. sqlId.AndEx("t.logid", r.LOGID, r.LOGID > 0)
  250. sqlId.AndEx("t.userid", r.USERID, r.USERID > 0)
  251. sqlId.AndEx("t.nodetype", r.NODETYPE, r.NODETYPE > 0)
  252. sqlId.AndEx("t.goodsid", r.GOODSID, r.GOODSID > 0)
  253. sqlId.AndEx("t.agreementid", r.AGREEMENTID, r.AGREEMENTID > 0)
  254. sqlId.AndLike("u.accountname", r.USERNAME)
  255. sqlId.AndLike("c.agreementno", r.AGREEMENTNO)
  256. sqlId.AndLike("c.agreementname", r.AGREEMENTNAME)
  257. return sqlId.String()
  258. }
  259. // GetDataEx 获取客户协议签约流水
  260. func (r *QhjCustomerSignLog) GetDataEx() (interface{}, error) {
  261. sData := make([]QhjCustomerSignLog, 0)
  262. err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
  263. for i := range sData {
  264. sData[i].calc()
  265. }
  266. return sData, err
  267. }
  268. // QhjUserNodeCfgAndStatus 客户签约节点和状态
  269. type QhjUserNodeCfgAndStatus struct {
  270. AGREEMENTTYPE int32 `json:"agreementtype" xorm:"AGREEMENTTYPE" form:"agreementtype"` // 协议类型 - 1:注册 2:登录 3:交易
  271. AGREEMENTVERSION int32 `json:"agreementversion" xorm:"AGREEMENTVERSION" form:"agreementversion"` // 协议版本号
  272. NODETYPE int32 `json:"nodetype" xorm:"NODETYPE" form:"nodetype"` // 环节类型 - 1:注册 2:登录 3:购买 4:融资购买 5:定投 6:卖出
  273. CONFIGID int64 `json:"configid" xorm:"CONFIGID" form:"configid"` // 配置(SEQ_QHJ_NODEAGREEMENTCONFIG)
  274. AGREEMENTID int64 `json:"agreementid" xorm:"AGREEMENTID" form:"agreementid"` // 协议ID
  275. CREATETIME string `json:"createtime" xorm:"CREATETIME" form:"createtime"` // 创建时间
  276. GOODSID int32 `json:"goodsid" xorm:"GOODSID" form:"goodsid"` // 商品ID [默认为0, NodeType>=3 的为商品值]
  277. AGREEMENTNO string `json:"agreementno" xorm:"AGREEMENTNO" form:"agreementno"` // 协议编号
  278. AGREEMENTNAME string `json:"agreementname" xorm:"AGREEMENTNAME" form:"agreementname"` // 协议名称
  279. AGREEMENTCONTENT string `json:"agreementcontent" xorm:"AGREEMENTCONTENT" form:"agreementcontent"` // 协议内容
  280. USERID int64 `json:"userid" xorm:"USERID" form:"userid"` // 客户ID
  281. SIGNTIMESTAMP string `json:"signtimestamp" xorm:"SIGNTIMESTAMP" form:"signtimestamp"` // 签约状态时间戳(最近一次)
  282. TRADEDATE string `json:"tradedate" xorm:"TRADEDATE" form:"tradedate"` // 签约交易日(yyyyMMdd)
  283. }
  284. func (r *QhjUserNodeCfgAndStatus) calc() {
  285. }
  286. func (r *QhjUserNodeCfgAndStatus) buildSql() string {
  287. var sqlId utils.SQLVal = "with k as" +
  288. " (select *" +
  289. " from (select row_number() over(partition by userid, nodetype order by tradedate desc) cnt," +
  290. " r.*" +
  291. " from QHJ_CustomerSignStatus r)" +
  292. " where cnt = 1)" +
  293. "SELECT t.CONFIGID," +
  294. " t.NODETYPE," +
  295. " t.GOODSID," +
  296. " t.AGREEMENTID," +
  297. " t.AGREEMENTTYPE," +
  298. " t.AGREEMENTVERSION," +
  299. " to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
  300. " c.agreementno," +
  301. " c.agreementname," +
  302. " to_char(c.agreementcontent) agreementcontent," +
  303. " k.userid," +
  304. " k.tradedate," +
  305. " k.signtimestamp" +
  306. " FROM QHJ_NODEAGREEMENTCONFIG t" +
  307. " LEFT JOIN QHJ_AGREEMENTCONFIG c" +
  308. " on t.agreementid = c.agreementid" +
  309. " LEFT JOIN k on k.nodetype=t.nodetype and k.userid=%v" +
  310. " WHERE 1 = 1"
  311. sqlId.FormatParam(r.USERID)
  312. sqlId.AndEx("t.configid", r.CONFIGID, r.CONFIGID > 0)
  313. sqlId.AndEx("t.nodetype", r.NODETYPE, r.NODETYPE > 0)
  314. sqlId.AndEx("t.goodsid", r.GOODSID, r.GOODSID > 0)
  315. sqlId.AndEx("t.agreementid", r.AGREEMENTID, r.AGREEMENTID > 0)
  316. sqlId.AndEx("t.agreementtype", r.AGREEMENTTYPE, r.AGREEMENTTYPE > 0)
  317. sqlId.AndEx("t.agreementversion", r.AGREEMENTVERSION, r.AGREEMENTVERSION > 0)
  318. sqlId.AndLike("c.agreementno", r.AGREEMENTNO)
  319. sqlId.AndLike("c.agreementname", r.AGREEMENTNAME)
  320. return sqlId.String()
  321. }
  322. // GetDataEx 获取客户签约节点和状态
  323. func (r *QhjUserNodeCfgAndStatus) GetDataEx() (interface{}, error) {
  324. sData := make([]QhjUserNodeCfgAndStatus, 0)
  325. err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
  326. for i := range sData {
  327. sData[i].calc()
  328. }
  329. return sData, err
  330. }